Xamarin vs Flutter

Luigino De Togni
5 min readJun 13, 2018

--

First impressions from a cross platform developer

Let me quickly introduce myself:

I’m a developer since 2003, i worked in different os/environments, mainly on payment systems: pos (Yes! Just those “devices” you see everytime you have to pay with your card. Have you never heard of Ingenico/Verifone/Pax?).

2 years ago a big corporate customer asked my company to bring insurance payment system everywhere, both on mobile and desktop environments.

After an evaluation time I decided best solution is using Xamarin Forms (just in 2016 it was acquired by Microsoft and It became practically free for all developers without an enterprise subscription).

With Xamarin Forms I completed this mission porting insurance payments apps to iOS, Android & Windows 10 (UWP). All this was done, however, having to struggle hardly about comunication app/mpos: i had to port (bind) native ios/android pos manufacturer libraries to be able to communicate via bluetooth with mobile pos.

This year i discovered & I’m playing with Flutter, new cross platform framework made by Google, so i decided to start writing a post to show the differences from Xamarin Forms and the “good things” I’m experiencing with Flutter.

Let’s begin…

N.B.: all the source code discussed here is available on github.

All tests was made with Flutter v0.4.4 beta3 & Xamarin Forms 3.0.0. Tests are not official technical benchmarks, they was executed to only show the real perception/feel from a developer who needs a fast and productive tool.

1. Language

Xamarin has C# as main programming language (F# for those braver…), while Flutter has Dart.

C# doesn’t need any introduction, it’s an old but mature & powerful language from Microsoft. Reaching last c# versions 6/7 Microsoft keeps it updated & “modern”.

Dart is relatively younger, but this can be a benefit because it was born with only modern language features (many parts of C# are nowdays legacy & redoundand.

Like C# it’s a OO language and sintax is not so different .

2. Assets (images, icons & other files)

First nice thing: Flutter, unlike Xamarin Forms, manage assets in one place!

In Xamarin Forms you have save every png, font, etc in a specific asset folder (with exact compile property) depending on os you are working on (Android/iOS/UWP).

In Flutter you simply set all resources files in a single asset configuration (with subfolders if you need) described in project yaml file!

Mantaining, updating & synchronizing files resource it’s a big annyoing job, so I can say:

This is really useful & time saving feature which Xamarin has not.

In Flutter you simply set all resources files in a single asset configuration

Try this demo :)

This is the final result in iOS (iPhone X) & Android (Samsung Galaxy S8)

I’m an Italian developer, I could not miss the chance to use a photo of “David di Michelangelo” :)

3. App “road tests”

I developed a simple Rest Api app which get a comic image & description from xkcd, to test size & performances differences. All test was made using packages in release mode, using my Samsung S8 and an old iPhone 5. Http GET specs are here.

Here the results (obtained by a simple manual timing from http://online-stopwatch.chronme.com)

Size

  • Android (tested on my Galaxy S8): Flutter makes the apk size half than Xamarin (7MB instead of 14MB)
  • iOS (tested on an old iPhone 5 32bit, so builds was set for arm7, amr7s, arm64 for both Xamarin & Flutter): Flutter make the ipa size 35% smaller than Xamarin (15MB instead of 23MB)

Probably best size test would be using plugins, I will update this section.

Startup time

  • Android: Xamarin app take, on average, 1.75 seconds to complete the main UI (http get take on average 1.80 seconds). Flutter apk take less than 0.5 seconds (http get take less than 0.6 seconds)
  • iOS Xamarin app take, on average, 1.1 seconds to complete the main UI (http get take on average 1.1 seconds). Flutter ipa take less than 0.5 seconds (http get take less than 0.5 seconds)

Ram

  • Flutter app “steals” on my S8 51MB while Xamarin app “steals” 72MB
  • Flutter app “steals” on iPhone 5 24MB while Xamarin app “steals” 26MB (results read from macOS instruments tool)
Flutter makes the Android app size half than Xamarin

Try this demo! :)

This is the final result in iOS (iPhone 5) with Flutter (left) & Xamarin Forms (right)

4. Supported platforms

Flutter was born to support iOS & Android platforms, while Xamarin Forms has a bigger ecosystem: iOS, Android, UWP (Windows 10 apps), WPF (Windows legacy apps, it’s a new entry), macOS which is in alpha stage & i think not ready for production.

5. Plugins / Access to native os features/third party native libraries

The big feature really impressed me is how you can call native code & libraries, without binding and c#rping the code & going crazy with the fear of not importing all correctly.

In the next episode I will go into detail showing my experience with a real big Ingenico Mobile Pos library , stay tuned! :)

Lewix

--

--

Luigino De Togni

Lucky husband & father, developer & passionate about #fintech #payments #smartcards #mobile, old times piano player. My lab: https://github.com/lewixlabs