What is Flutter?
For the record, this isn’t the first time I’ve fallen hard for a new Google technology (anyone remember GWT). That said Flutter is receiving glowing praise from the developer community, myself included.
Here are some key points to be aware of:
- It’s completely open source, you can drill down into the libraries to understand how they work and debug problems.
- Everything is a widget, the architectural patterns are very similar to Adobe Flex.
- It’s becoming very popular very fast.
- It supports hot reloading which applies code changes in real time while retaining the application state.
- It provides a comprehensive widget library.
Some of the drawbacks:
- It’s very new, although Google claims it’s ready for production.
- It requires learning Dart.
- The app size will typically be larger than a native app.
Finally some of the reasons I believe Flutter will succeed:
- ARM is the future of mobile/mobile is the future of computing.
- Probably most importantly… it’s fun to use.
Setting up a Development Environment
I then switched to my MacBook. After dealing with a Homebrew issue I was able to get it running. The last OS I tried was Windows which worked out of the box.
You can choose between two code editors: Android Studio (which is built on IntelliJ) or Microsoft’s VS Code. I’ve found VS Code runs faster however Android Studio provides a more seamless experience with better debugging tools.
A few points worth mentioning:
- On first launch I had trouble with the Android virtual machine. By default it uses x86, I needed to download a 64bit version for it to run.
- I initially started on the
betaFlutter channel but after a short while I ran into an issue which forced me to change to the
When I learn a new technology I’m a fan of reading a book cover to cover, sadly I wasn’t able to find any Flutter books on Amazon (yet). That said their docs are excellent and there are a fair number of tutorials online.
Here are some standout references.
- Udacity course – Build Native Mobile Apps with Flutter
- Awesome Flutter – A curated list of awesome Flutter components, plugins, tutorials and best apps
- Architecture Samples – Strategies to help solve or avoid common problems.
- FlutterDev – Reddit Subreddit
- Google Group – Flutter Google group
I’d also strongly recommend installing the gallery app on your phone, it’s a great way to discover all of the available widgets.
Finally, it’s worth mentioning that Flutter recently switched from Dart to Dart 2. A new feature in Dart 2 is the ability to remove the ‘new’ keyword when creating objects, you’ll notice a lot of older examples still include it while newer examples don’t.
Deciding on an Architecture
Probably the biggest decisions you make when developing an app (once the technology stack has been chosen) is deciding on the architecture. It seems the main choice right now comes down to whether or not to use Redux.
The latest advice from Google seems to be to use Streams and BLoCs (business logic components) to create reactive apps, that said it doesn’t preclude also using Redux. I think the co-author of the flutter_redux package explains it well on this Reddit post.
Redux is basically a StreamController sitting in an InheritedWidget at the root of your app. StoreConnector is just a wrapper for StreamBuilder with some helper functionality.
Note: the comment will probably make more sense once you’ve learned what any of those words mean.
Starting to Code
At this point I’ve only been writing Dart/Flutter for a few days but I think I have a reasonable sense for the possibilities it enables.
Live reload is amazing but I should point out it doesn’t always work, it’s useful when fine tuning the style of a screen but can fail when making large changes to the codebase.
And finally, back to Dart. I remember first hearing about it and thinking it looked cool but at the time I had no reason to use it, with Flutter that’s no longer the case.