Why Flutter? An Android Developer’s take
Recently in the news as a revolutionary new mobile platform, Flutter has built up a lot of hype inside the mobile app developer community and outside it as well. What is the hype about? After the Flutter Beta 2 release, how much promise is the platform showing? Should mobile developers switch to Flutter? Let’s take a look.
What is Flutter?
First off, let’s take a look at the official description of the platform from flutter.io:
Flutter is Google’s mobile app SDK for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.
Here are the important parts from that statement:
- “high-quality native interfaces” : Flutter contains elements from both Android and iOS, but unlike React Native, all elements, or “widgets”, are usable on both platforms. An app can now look exactly the same on both platforms instead of adopting platform specific looks.
- “iOS and Android in record time” : The same codebase is usable for both Android and iOS apps reducing the need for separate development for Android and iOS. “But couldn’t we do the same in React Native?” Yes, but because RN pulls interface elements from the device, a lot of elements were platform specfic, rendering a single codebase to be larger than it needs it be.
What if I only want an Android app?
Flutter isn’t only focused on bridging the Android-iOS gap, it’s focused more on being a better way of building a mobile app. Native android development has some inherent issues, a lot of which developers don’t have many workarounds for. Here are a few key points for Android developement in Flutter:
No large repetitive Gradle build times.
Although gradle is a useful tool, the gradle build times for apps are rather large and is a hindrance for fast development cycles. This is not to say Flutter apps do not need a Gradle build at all, but they don’t need it multiple times. A flutter build invokes a Gradle build the first time it runs but does not need it again for a full restart of the app. Android Studio has reduced Gradle build times over time and features like Instant Run certainly are helpful but Flutter load times beat native times by leaps and bounds. Flutter’s hot reload is immensely helpful in smaller changes.
A single language for layout and backend.
Because Android has separate layout and Java/Kotlin files, we need to get references for views and then alter them in the backend files. Flutter uses a single language(Dart) for design as well as backend and uses a reactive framework, so we don’t need references to widgets(Flutter equivalent of views) at all.
Dart: making the obvious things easy.
Java has been showing it’s age for a while now and even after Java 8, it leaves a lot to be desired. Dart on the other hand borrows a lot of the most popular features of other languages without losing the familiarity of Java or similar languages. Dart was developed with common developer tasks in mind, making common things effortless and I’d really recommend checking out the: Dart Language Tour.
Common animation patterns are heavily simplified and are optimised for 60FPS. As an example, consider taking a look at Hero Animation which is common on apps like the Play Store.
- Flutter speeds up development by quite a bit.
- Easy-to-learn development language for existing mobile developers.
- Fluid animations and beautiful UI.
- Allows Android + iOS apps from the same codebase.
No platform is perfect and sometimes the lack of a particular feature can be a dealbreaker. Here are ones I personally think should be considered before you think of switching:
- Flutter is still in Beta: Being in Beta, stability isn’t completely guaranteed and a few bugs should be expected here and there. Some functionality developers usually take for granted may not exist on the platform.
- Lack of packages: There are not as many packages written for Dart meaning you might have to write code for something you would usually do with a simple library or package. This is not a minor issue and should be treated with caution.
- No layout editor: Unlike in XML, there is no drag-and-drop interface available which could be a deal-breaker to some. Flutter does provide Flutter Outline to visualise the component tree better but it’s not as useful as actually looking at a generated screen.
- Limited StackOverFlow support: Because Flutter is new, support isn’t as extensive as normal Android, but the Flutter team is quite active on StackOverFlow, so all hope isn’t lost.
I’ve been working with Flutter mostly for the the shared codebase between platforms and the UI elements and animations, and I recommend every mobile developer to give it a spin. It’s a fresh new way to see mobile app development.
A few helpful hints:
- If you’re new to mobile app development, I’d recommend you to try native app development before jumping onto Flutter because for a novice, it has a sharper learning curve.
- Do a feasibility check for a production-level app because the packages you need may not be available.
- If you’re already an Android dev, do not miss : Flutter for Android Developers