Your web browser is out of date. Update your browser for more security, speed and the best experience on this site.

Update your browser
CapTech Home Page

Technical November 10, 2020

Flutter Explained By a Java Developer

Mylon Blueford
Author
Mylon Blueford

What is Flutter?

Announced by Google in May 2017 at their I/O Conference and officially launched in December 2018, Flutter is Google’s UI toolkit for building natively compiled applications for mobile, web, and desktop from a single codebase.

Open source and written using the Dart programming language — which was also introduced by Google in 2011 — Flutter essentially enables developers to write code once, and have it compiled natively across multiple devices while maintaining the same UI/UX design. This allows companies, especially start-ups, to quickly produce a Minimal Viable Product, test new features and expedite their time to market.

The Pros & Cons

The majority of my career I have been a back-end developer, specifically, a Java Developer. However, I do have experience working in Full-Stack environments, and have worked with front-end languages and libraries. I picked up Flutter recently to learn how to build mobile apps and jumped right into getting a certification from a Google-sponsored bootcamp. My pros & cons list is written from the perspective of a back-end engineer with recent experience and training in Flutter. It is important to call out that my list may differ from that of someone coming from a React-Native background or similar technologies. I say that not to discredit myself, but to provide context as to why some things may be valued more than others.

Pros

The Dart Programming Language

One of the benefits of Flutter being written in Dart is that it is a fairly easy language to learn for those coming from programming backgrounds — especially for those coming from Object Oriented Programming(OOP) languages, such as myself. Google designed Dart with the intention of building a robust, easy to learn programming language that is optimized for building user interfaces. In doing that they combined a lot of the syntax and structure of popular OOP languages like Java and Javascript.

For example, here is a simple class structure written in Dart:


In addition, Dart code compiles directly to native Android or iOS code without requiring an additional layer, unlike frameworks like React that rely on a Javascript bridge to communicate with native modules. By removing this layer, Flutter is able to increase the overall speed and performance of its apps.

Powerful UIs & Complex Animations in Seconds

One of Flutter’s most powerful components is its reusable widget design pattern. In Flutter, common UI components can be extracted into a separate widget. Following OOP principles, these widgets can be abstracted, extended, or inherited by other widgets. This allows for developers to build rich, complex UIs while also reducing the overall amount of written code. In addition, it allows for UI properties like size and color to be defined globally instead of for each individual component. Flutter also comes prepackaged with several animations right out of the box, and adding them to your app can be done in fewer than 5 lines of code. Click here to learn how to add a Hero animation (a widget that flies between screens).

Customizable Packages

Flutter comes prepackaged with several frameworks like Material Design, and Cupertino, which allows for powerful mobile development right out of the box. Although, this may cause the overall size of Flutter apps to be larger, it allows for developers to build rich UIs without a need for additional 3rd party libraries. However, as Flutter is an open-source platform, there are several packages built by the online Flutter community that can be easily integrated into your project. Finding a package for your project is as simple as going to pub.dev and searching for whatever component you need. Whether you’re trying to internationalize your app, add a calendar, or integrate your project with Firebase, there is a pre-built package available for you to use. This is a huge advantage for start-ups or companies that are trying to quickly develop or scale up their mobile app as you don’t have to spend time developing portions of your app.

Design & Development in Parallel

Another powerful feature in Dart is the ‘Hot Reload’, which works by injecting updated source code files into the running Dart Virtual Machine (VM). After the VM updates classes with the new versions of fields and functions, the Flutter framework then automatically rebuilds the widget tree, allowing you to quickly view the effects of your changes. For example, if a designer wanted to change the color of a widget to test a new design, with hot reload they will instantly see the change after the code is updated without losing the current state of the app. This allows for design and development to work in tandem with one another, as teams can easily prototype new designs without wasting time waiting for the server to publish/rebuild after each change.


Cons

The Flutter Community

As Flutter is only a couple of years old, the online community for Flutter isn’t nearly as robust as that of other platforms. This can be problematic when trying to solve complex issues as StackOverflow and Google searches may not easily yield the answers to your questions. However, the Flutter team is very responsive to issues asked on the Flutter Github, and although the community is small, there are some online forums available to collaborate with other Flutter developers.

Young Technology

Like any new technology, there is always some apprehension on if it will gain traction and continue to be supported in the future. However, being that Flutter is supported by Google, it’s more than likely that Flutter will continue to grow and be supported in the future. Nevertheless there is always some level of risk associated with committing to a technology or language that is still in its infancy.

Limitations

Even though Dart is compiled to native code, that does not make it a native iOS or Android language. As such, there can be some limitations when trying to access certain native components like the video player. There are implementations of video players in Flutter, but they differ from the native system player. Although there is almost always a workaround for situations where a native component may not be supported, it just may require a little extra work.


Flutter’s Place in the Market

The original intention of Flutter was to build apps that run natively on Android and iOS, but as our world becomes crowded with more devices, the Flutter team has switched their focus from Device-centric to App-centric development. This means shifting the focus away from the devices themselves and onto the actual environments on which the apps are run. This approach separates Flutter from almost every other app development platform currently in the market, and puts Flutter in a great position to grow exponentially in 2021. Imagine maintaining a single codebase for an app that runs on Android, iPhone, Apple TV, Macbook, and the Web.

In 2019, a LinkedIn analysis ranked Flutter as the #1 fastest growing skill among software engineers. Well-known companies like The New York Times, Alibaba, Groupon, Sonos, Capital One, and Ebay, are already taking advantage of Flutter’s capabilities, and that is only expected to grow.

Other apps such as the official app for the popular Broadway Musical Hamilton and Google’s Stadia app were built entirely using Flutter. Also, Dream11, which is India’s largest fantasy sports company with over 50M+ users, built their fantasy sports app using Flutter.

Summary

Flutter is quickly gaining popularity in the development community. For those interested in a hands on approach to learning Flutter I recommend The Complete Flutter Development Bootcamp with Dart, I found this guide very informative and easy to follow, and by the end of the bootcamp you will have built several apps that you can leverage to create even more complex apps.

I have thoroughly enjoyed working with Flutter these past few months. As a developer with mostly back-end experience I have found it to be a very fun platform to learn. The “hot reload” feature is something I particularly enjoy, as its great being able to see your changes reflected in real time. Oftentimes when writing backend code you have to rebuild/redeploy your code to the server for every change, which quickly becomes quite tedious.

On the other hand, there are some Flutter concepts, like State Management, that I have found to be a pretty steep learning curve. However, there is plenty of material available online to further explain those concepts in greater detail.

SOURCES:

Thanks to Dylan Doggett