How to migrate smoothly from Xamarin to Flutter? 

Rating: 5.00 / 5 Based on 6 reviews

Free product design tips
Join our newsletter and get insights that will change your product design perspective
By submitting your email you agree to receive the content requested and to LeanCode's Privacy Policy.
or follow us

Xamarin used to be a good choice for multiple platforms

The support for Microsoft Xamarin ends on 2024-05-01. This marks an end to a great story of a powerful framework for developing cross-platform mobile applications using C# which Microsoft acquired in 2016. Does it mean that the teams that decided to use Xamarin for mobile development should consider it a mistake? Well, definitely not. 

First of all, Xamarin was a reasonable choice for the teams mainly operating with C# to produce some not-so-complicated iOS and Android apps. Imagine you had an ERP system, and the warehouse workers with some Android phones, who were not insisting on a brand new design or modern user interface, were good with a Xamarin app. They were good with anything that worked, and Xamarin did its job in specific business cases. 

From Native to Xamarin to React Native to Flutter and why Flutter is the best choice for mobile platforms

As former startupers at LeanCode, we were also fed up with the idea of building one iOS and Android app twice for two separate platforms and were researching different cross-platform frameworks. Tempted by the opportunity to move our C# .NET Developers into the full-stack category, we started using Xamarin for our clients' projects in 2017. Initially, everything was fine. Very early, we dropped the idea of using Xamarin Forms as this was limiting for our UX Designers' and clients’ needs, and we decided to stick to Xamarin Native. Those were pretty advanced apps, with Lottie animations inside and all that fancy stuff.

With the arrival of new batches of changes to the existing Xamarin apps from the business stakeholders, we were increasingly struggling with code changes and their maintainability. They were also not easy to scale and extend, and once the user base grew and more exotic Android phones came into play, the apps seemed to be less stable. Therefore, we’ve made a decision to explore the opportunity to migrate from Xamarin to React Native. 

We went through a migration process for a couple of projects, and it was a huge relief from the developer’s perspective. Yet, the arrival of the Flutter framework really changed it for the better. Thanks to Skia, Flutter was the quickest to build appealing interfaces with pixel-perfect UI components. The Flutter ecosystem also provides platform channels, which are a natural way to integrate with native code. What is more, its performance, scalability, and maintainability were proven by LeanCode in a number of projects where the Flutter apps went through diligent security, penetration, and performance audits, for example, in the mobile banking Flutter app for Credit Agricole, which we’ve built.

In 2020, we decided to build all our new applications in Flutter. We no longer accept business from clients determined to use Xamarin for their mobile app development. We were also able to convert apps from Xamarin to Flutter (a case study of Gastro Job's smooth transition to a Flutter app) and even talked about this experience during Flutter Europe.

New MAUI and old Xamarin problems

Many Xamarin Teams are now deciding whether to migrate from Xamarin to MAUI or to choose some other framework for developing cross-platform mobile applications.

MAUI for Xamarin Native projects

The effort needed to migrate from Xamarin to MAUI for Xamarin Native apps is comparable to the major upgrade, and provided there is no tech debt, everything should be smooth. This also indicates that practically little changes. This is still an old Xamarin framework, where you cannot rely on hot reload, which makes it almost impossible to integrate with native SDKs, which is not possible to embed to the native platform, which does its magic while building the apps, etc. The complete list of problems you can find in our article comparing MAUI vs Flutter.

MAUI for Xamarin.Forms projects

Migration from Xamarin.Forms to MAUI is a different animal, as those XAML structures are not replicated in MAUI, and most of the screens using forms have to be recreated. It means that an effort is substantially different. This means that any migration to MAUI may result in sunk cost and a wasted potential to move to another, more capable framework based on the latest technologies. And because of the problems mentioned earlier (no native SDK support, the lack of embedding of native code, blackbox builds, failing hot reload, etc.) in the battle Flutter vs. MAUI, the odds are against the Microsoft framework.

The human and tech aspects of switching to Flutter from Xamarin

Not everybody will welcome the change. Switching to Flutter from Xamarin is no exception. There are always nay-sayers among Xamarin developers who are against anything that is new. Yet, from our experience, old Xamarin teams often didn’t like Xamarin at all, and they embraced the change, though sometimes silently. 

For them, an effort to build another interactive component, recreate some native mobile behavior, or deal with the code from a year ago were the top 3 reasons for blue Mondays. They would consider any modern framework as a relief. Since Flutter is recognized for its best developers' experience, they will be surprised by the great tooling and stateful hot reload feature. It’s always hard to take the first step, but the first step toward Flutter resonates very well with the team, and soon, the first evangelists appear. 

From the Team Leader's perspective, you need to remember both the human aspect of migration from Xamarin to Flutter and how to organize the technical part of that transition. We will cover both parts in subsequent chapters.

Migrating from Xamarin to Flutter

In the C# world, there are certain patterns that were solidified by that time and countless projects and are now considered as close to laws. The case is different for Flutter, which is much younger. If you want to choose, for example, state management, you need to follow the battle between Block, Riverpod, Provider, or Redux. 

The same goes for design systems, navigation, flavoring, monitoring, CI/CD, communication with servers, strongly typed contracts, and many others. You can spend your life literally navigating between all possible choices. Fortunately, with our team of 25+ Flutter Developers at LeanCode, we were able to prepare our opinionated way of building Flutter apps using feature-based architecture. A comprehensive guide into how to adopt all those practices for building large-scale apps has been covered in our ebook Flutter for Enterprise.

Dart language vs. C#

For the Flutter project, you need to learn a new programming language: Dart. It is not as hard as it seems as a first encounter. Dart code is relatively easy to master as it is close to C# and Java in syntax. Looking for alternatives, Dart is definitely far more intuitive to learn for C# developers than Swift or JavaScript in the case of React Native. Therefore, it will take some time for the team to transfer and show true velocity, but this goal is totally achievable, and you should not take any excuses. Flutter and Dart teams also made an effort to streamline this experience for Xamarin developers by publishing this very helpful guide detailing the migration process.

Upskilling your existing Xamarin developers to Flutter

Converting your team to Flutter requires extra care to ensure all Xamarin devs adopt smoothly and their motivation stays high. There is always this adoption cycle of a new framework, where even early enthusiasts, when they stumble upon the first hurdles, lose their spirit and start to complain. At LeanCode, we have several clients who started on their own by building PoCs or even the core apps, but pretty soon, they realized they were lost and they were missing a Flutter/Dart seniority in their teams. 

This is why at LeanCode, we have created a dedicated service for Flutter Team Augmentation: Flutter Hybrid Teams. In this model, our senior developers, often in leadership roles, join the in-house team to guide the team through the transition period. We have carefully designed best practices for all-hands workshops and p2p code reviews, which allow us to explain and implement our bulletproof architecture. Hybrid Teams proved to be the most efficient way of training the team. They speed up the knowledge transfer and allow you to confidently move forward without the risk of making some bad decisions in the meantime.

Don’t start from scratch

The great benefit of MAUI is the ease of integration with your .NET/C# environment. At LeanCode, our backend team also uses .NET and Microsoft Stack. In order to provide a connection between those two worlds, we have created an open-source .NET framework, Core Library, which enforces strongly typed contracts between server and client applications. It hugely streamlines the Flutter development and helps to maintain coherence between the backend and frontend teams. We have a strong track record of scaleups and enterprise clients (Shell, Maspex, and others) using our framework with over 50 implementations over the last 7 years, and you can always reach out to us for more information.

Don't reinvent the wheel

In the Flutter ecosystem, you can expect more than just a Hello World app in the beginning. Thanks to the vibrant and growing community, several independent projects provide a reusable app template with UI components and some initial widgets to save on development time for future projects. At LeanCode, we have also created such a template for iOS and Android apps, with the design system independent of material design, which allows the creation of a powerful Flutter app with user onboarding, popular SSO, chat, notification center, and several other important features which you can use in your project.

Say goodbye to Xamarin, start your migration journey to Flutter

This technology shift is irreversible. The sooner you start migrating your mobile apps from Xamarin to Flutter, the sooner you will start reaping the benefits of this most capable framework. With the framework's advanced development, you may also benefit from using Flutter for Web or Flutter for Desktop implementations to reduce the complexity of your client's architecture further and really adopt the one-code policy. At LeanCode, we can support you with our knowledge and skills to make this migration process as smooth as possible, and with our own set of internal solutions dedicated to flutter development, it will be faster than starting from scratch.

Free product design tips
Join our newsletter and get insights that will change your product design perspective
By submitting your email you agree to receive the content requested and to LeanCode's Privacy Policy.
or follow us
Rate this article
5.00 / 5 Based on 6 reviews
Meet our expert

Let's talk!

Łukasz Kosman
CEO at LeanCodelukasz@leancode.pl
Łukasz Kosman, CEO at LeanCode

You may also like

Flutter Pros and Cons 2024 - Summary and Recommendations

Flutter is loved by many for its simple and fast development of high-quality cross-platform apps. Let’s take a closer look if Flutter is a suitable solution in every case, i.e., when developing mobile, web, and desktop applications.
Is Flutter good for app development?

Flutter vs. .NET MAUI: Which Framework to Choose for Cross-Platform Applications?

Cross-platform solutions provide significant time and cost savings. However, you can encounter drawbacks with some platform-specific features and performance, and that’s where it’s worth being aware of the differences between each framework since they may impact your final decision. Read our comparison of two popular solutions: Flutter vs. .NET Maui.
Flutter vs. .NET Maui

Feature-Based Flutter Architecture - LeanCode

Read about the LeanCode approach to Flutter architecture. We highlight some of the design decisions that should be made when developing a feature in mobile apps. This includes our approach to dependency injection, state management, widget lifecycle, and data fetching.
Flutter architecture by LeanCode