Mobile Developers Champion Flutter for Xamarin
Flutter, Google's new mobile UI framework for creating native mobile apps, is already being targeted for Xamarin development in an open source project on GitHub championed by a handful of developers.
Flutter for Xamarin is "still under construction" after several months and isn't expected to become a commercially viable mainstream product, but its goal of making the Flutter SDK available on the .NET Framework has stirred up some developer interest.
Flutter 1.0 arrived last month with a new way to code mobile apps, using the Dart programming language, its own React-inspired widgets (as opposed to native iOS and Android widgets), hot reload and fast performance boosted by hardware acceleration, among many other notable characteristics.
But even before that, some developers started the Flutter for Xamarin project, led by Adam Pedly, whose GitHub project says: "This project is never expected to be commercially viable, unless it is picked up or supported by a larger company. As it currently stands, this is just a fun side project, done by a bunch of developers in their spare time. We offer no support for solutions ever built with this framework, or any guarantee of completion."
Despite such caveats, some community coders have voiced support for the project. In the programming section of the Reddit social site, for example, Flutter for Xamarin was posted about three months ago, with the first response being "why?". Another developer quickly answered, "It's not exactly hard to come up with possible reasons" and proceeded to do just that:
- Because you still want to work in C# but want the ease of use and performance of Flutter?
- Because you have existing .NET logic code shared with other projects that you want to re-use?
- Because you still want to take advantage of the vast array of .NET assemblies and nugets at your disposal?
- Because the maintainer wanted a hobby project to see what was possible?
Flutter for Xamarin's underlying technology includes SkiaSharp, described as "a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images."
While Pedly and his cohorts are trying to initially support Xmarin.Android, Xamarin.iOS and UWP (Universal Windows Platform) projects, the GitHub site says there's no reason such support can't be extended to any other target that supports SkiaSharp. A transpiler will convert the Flutter SDK, which itself is written in Dart, to C# to be used in .NET applications, through use of the DartAnalyzer to examine the SDK and output it in C#.
"Flutter Bindings will include the connection between SkiaSharp and the Flutter SDK," the project site says. "We will not be using the actual Flutter engine, though we may do in the future.
"Due to previous exploratory work, the Flutter engine is difficult to integrate with since we need to expose many C++ level APIs. Due to how this is implemented in the Flutter engine currently, it would require certain modifications and would be difficult to keep in sync with the master repository.
"Hence, we will map the calls directly to SkiaSharp and Harfbuzz to draw directly on a SkiaCanvas. I could regret this, we shall see :)"
Coincidentally, the Flutter for Xamarin project isn't the only initiative connecting the two technologies, as the Flutter team has posted "Flutter for Xamarin.Forms developers" guidance, "meant for Xamarin.Forms developers looking to apply their existing knowledge to build mobile apps with Flutter."
Alois Deniel, a Xamarin developer with four years' experience, also compared that platform with Flutter in a January post titled "Flutter Introduction from a Xamarin Developer."
Developers earlier also sounded off on the "Flutter vs. Xamarin" question, with one noting "Flutter has MUCH better performance than Xamarin Forms" and another saying "Flutter will compete with Microsoft’s cross-platform mobile framework Xamarin" and another even claiming "I guess Xamarin is dead now."
Time will tell about such notions, but one thing for certain is that Flutter and Xamarin appear to be entering an interesting relationship.
David Ramel is the editor of Visual Studio Magazine.