Cross-platform application development frameworks makes it possible for developers to reuse code and to simultaneously deliver the same functionality across multiple platforms. In this article, we’ll be looking at two of the leading cross-platform frameworks, Xamarin.Forms and Flutter, to give you the ability to decide which frameworks is best suited for your company, your team and your application.

Xamarin.Forms from Xamarin Beginnings

The Xamarin platform allowed developers to create applications for iOS, Android and Mac, using C# (Windows (i.e. UWP) development uses C# already). This means that with the right architecture, developers can reuse code that is responsible for the business logic of the application. However, the user interface still needs to be created using XML to create the pages on Android, and storyboards on iOS. Subsequently, Xamarin.Forms was introduced which allowed developers to reuse not only their business logic but also the code that defines the user interface.

Xamarin.Forms provides the following advantages:

  • The user interface code is typically shared across all platforms using the eXtensible Application Markup Language (XAML).
  • The Xamarin.Forms user interface controls have the same look and feel as standard controls for each individual platform.
  • Business logic can be written all in one programming language, with C# being the most common.
  • Developers get access to the standard .NET APIs. If they are familiar with these APIs, they should feel right at home developing with Xamarin.Forms.
  • Xamarin.Forms has a bigger ecosystem compared to most cross-platform alternatives. There are more third-party libraries available and resources that could be used for learning.
  • The Xamarin.Forms community has developed comprehensive best-practices and guidelines. For example, the MVVM (Model-View-ViewModel) architectural pattern is a typical way to structure application code. There are various libraries available for developers to use that implement MVVM and other patterns.
  • Xamarin.Forms targets more platforms than its competitors. For example, applications can also be written to run on desktop/tablet PCs and Macs, and even devices that run Tizen (e.g. Samsung watches and TVs).
  • Xamarin is owned by Microsoft, who continue to make substantial investment into making it easy to access the wider Microsoft ecosystem, such as being able to connect applications to Azure, Microsoft’s Cloud platform.
  • There are multitudes of libraries that target .NET and can be used when writing Xamarin.Forms applications, such as Json .NET, which is commonly used for serialising and deserialising JSON, and xUnit, a popular unit testing framework.
  • It is possible to develop applications on a Windows PC (debugging iOS applications is possible via a remote connection to a Mac), or on a Mac.

Some drawbacks of Xamarin.Forms:

  • Creating a consistent or custom user interface can be more difficult. This typically requires changes to be made for each platform.
  • If developers need to use native platform SDKs, they will need to create bindings that will allow the SDK to be accessed from their C# code. This can be a difficult process to get working and would also need to be maintained each time the SDKs are updated.

Flutter: Game Changer or Another Google Flash-In-The-Pan Experiment

Flutter is a recent entry in the cross-platform application development space. In the post Cross-platform App Development with the Flutter SDK, we discussed some of the advantages and disadvantages it has. Compared to Xamarin.Forms, the Flutter SDK improves the developer experience with hot reload – a concept several frameworks have adopted to decrease the time spent waiting for the application to be built and deployed during development. When choosing to adopt either Flutter or Xamarin.Forms, there are several points to consider:

  • Flutter has a smaller ecosystem since it only reached a stable 1.0 release in December 2018. Whilst there are companies that have already used Flutter to publish applications, there are still third-party libraries and platform features that aren’t available yet.
  • The Flutter community is rapidly evolving and whilst there are a lot of discussions, to date, there is no clear guidance or best practice for Flutter application architecture.
  • Developers can write Flutter plugins that wrap native SDKs but must learn how to write code for a specific platform. This requires a significant investment to learn how to use various programming languages, their idiosyncrasies and best practices.
  • Flutter only supports building applications for Android and iOS. Desktop support is in the experimental stage and is being undertaken by the community. If support for desktop environments is a potential requirement, then it would be risky to adopt Flutter until desktop support is added to the Flutter SDK.
  • Flutter applications are written in Dart. When choosing between Xamarin.Forms or Flutter, consideration should be given towards what languages developers would feel comfortable working with and balance that with the general pros and cons that each framework has.
  • Flutter does not, out of the box, provide a clear separation between logic that defines the user interface and business logic. Without a clear strategy to manage the structure of an application, this can lead to complex monolithic style applications. Xamarin.Forms provides a clear separation between user interface logic (typically done in XAML) and business logic (typically done in view model or service classes). However, this separation comes with a tax, which is that it is developers need to understand how the separation works, and the interrelationship between the different code files.
  • It seems that Google does not view Flutter as an experiment, since they are using it to build a new operating system, Fuchsia, and has been heavily promoting it (e.g. at Google I/O) but Google has been known to stop supporting some of their products with little or no warning or explanation.
  • If you already have an existing application written purely in Android or iOS, Flutter can be added to an existing project. This isn’t possible with Xamarin.Forms. However, it is possible to add Xamarin.Forms to an existing Xamarin native project.

Going Cross-Platform

At Built to Roam, choosing the best technology for your company, your development team and your product is as important as the relative pros and cons of each technology.

The team at Built to Roam have worked with a wide variety of cross-platform tools, frameworks and technologies, and have the experience to guide you from technology selection, all the way through to application launch. We’ll be there along the way to help you navigate the ever-changing landscape of technology in order to deliver applications that will continue to exceed your customers’ expectations.

back