Friday, March 1, 2019

Why Flutter? I new Cross-Platform Framework made by Google !


Why Flutter?



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 First official release, how much promise is the platform showing? Should mobile developers switch to Flutter? Let’s take a look.

So .. 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:

  1. “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.
  2.  “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

What about Fuchsia?


Fuchsia is acapability-based operating system currently being developed by Google. It first became known to the public when the project appeared on GitHub in August 2016 without any official announcement. In contrast to prior Google-developed operating systems such as Chrome Os and Android, which are based on Linux kernels, Fuchsia is based on a new microkernel called "Zircon".






This OS is written in “ C , C++ , Dart , Go , Python , Rust , Shell , Swift “ and as you read the system is written in Dart , So according to rumors Flutter is preface to develop apps for Fuchsia also , in other words Flutter not just for developing Android & IOS Apps in the same time , it’s for Fuchsia also 




Key take-aways:

  1. Flutter speeds up development by quite a bit.
  2. Easy-to-learn development language for existing mobile developers.
  3. Fluid animations and beautiful UI.
  4. Allows Android + iOS apps from the same codebase.

Drawbacks?

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:
  1. 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.
  2. 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.
  3. 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.


Conclusion

I tried working with Flutter mostly for 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 helpful hints :

  1. 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.
  2. Do a feasibility check for a production-level app because the packages you need may not be available.

Happy Coding!

"Never Hesitate To Share Your Knowledge With The World".


EmojiEmoji