Picture this in your mind’s eye. You are the superintelligent and capable CEO of a new business. Obviously your mission is to maximize sales while minimizing expenses. “Hmmm.”, you think. “I can really increase sales if I make our products available on the Web.” So you ask your friends how to create a web app and they say ...
“You need to hire a web developer. They should know HTML, CSS, JavaScript, and probably some framework like React, Vue, or Angular.”
It’s expensive but you do it and your gamble pays off. Sales increase markedly. Trying to keep on top of demand, you monitor social media and engage your customers. You hear them say that this web app is great and all but “We’d have been here earlier if you had an app in the App Store.” So you talk to your team who, while being experts in the Web, are not iOS developers. They tell you ...
“You need to hire an iOS expert. They should know iOS, Swift or Objective-C, Xcode, macOS, and CocoaPods for development.”
Your research shows that this person is even more specialized and therefore expensive than your web devs. But again, it seems to be the right thing to do, so you bite the bullet and hire them. But even while this app is being developed, you see that the feedback was not isolated to iOS apps, but instead was looking at all mobile devices. And – oh, snap! – 85% of devices worldwide run Android, not iOS. You bury your head in your hands as you ponder whether or not you can afford to ignore 85% of your potential customers. Your advisors tell you ...
“You need to hire an Android expert. They should know the Android OS, Gradle, Android SDK, XML, Android Studio, and Java or Kotlin.”
“Really?!? Another developer?”, you say. “Yes. And one just as expensive as your iOS developer,” they respond.
Isn’t there one person who can do all three things? Some way to share the code between all of those environments? Then you could hire just one person. In fact, they could write the code one time and deploy it to the Web, to the App Store, and to the Google Play Store. One codebase to maintain. One place to make improvements and upgrades. One place to squash bugs.
Ladies and gentlemen, allow me to introduce you to Flutter!
What is Flutter?
Flutter is a set of tooling that allows us to create beautiful apps that run on iOS, Android, the Web, and desktop.1
Free (as in free beer. No cost)
Open source (that’s the other sense of the word “free”)
Backed by and originated at Google
Being enhanced and maintained by a team of developers at Google and hundreds of non-Google contributors around the globe
Currently being used by thousands of developers in organizations across the world for production apps
Fast because it compiles to truly native apps that don’t use crutches like WebViews and JavaScript bridges
Written one place and compiled to a web app for billions of browsers, an iOS app for iPhones and iPads, and an Android app for all of the rest of the phones and tablets out there
Why Flutter?
To build a better way to develop for mobile
Notice what is not in that mission. There’s no mention of Android (which is also owned by Google) nor of iOS nor of the Web. Flutter’s goal is to create a better way to develop for all devices. In other words, Flutter should be better to create iOS apps than Swift. It should be better to create Android apps than Kotlin. It should be better to create web apps than HTML/JavaScript. And if you get all of those things simultaneously with one codebase, all the better.
The Flutter team has succeeded spectacularly with this mission.
As proof, Eric Seidel offers this example.2 The Google CRM team used Flutter to build an internal Android app and did it three times faster than with their traditional Android toolchain!
But it turns out that Flutter isn’t the only game in town for cross-platform. You have other options.
The other options
Cross-platform development categories
Some technologies | Cons | Pros | |
---|---|---|---|
Progressive Web Apps (PWA) | HTML/CSS, React, Angular, Vue | Not a real app. Runs in a web browser. Not available in app stores. Hard to create a desktop shortcut. Cannot access many of the device’s resources like accelerometer, compass, proximity sensor, Bluetooth, NFC, and more | Easy to write |
Hybrid | PhoneGap, Cordova, Sencha, Ionic | Runs in a WebView so it can be slow. Nearly impossible to share code with the web app | Easier for web devs to learn because it uses HTML and JavaScript as its language and structure |
Compile-to-native solutions | React Native, NativeScript, Flutter, Xamarin | Learning a framework may be difficult. Mastering the toolchain definitely is | Real apps that can be found in the stores and run fast |
If you have a captive audience, one where users value your app so much that they’re willing to accept a poorer user experience, the cheapest solution is to create a PWA. If your app is extremely naive and speed is not expected to be an issue, a hybrid solution might be appropriate. But if speed, smoothness, and sophisticated capability are important, you will need to go with a native solution.
Native solutions
Compile-to-native cross-platform frameworks
Xamarin | NativeScript | React Native | Flutter | |
Year introduced | 2011 | 2014 | 2015 | 2018 |
Backed by | Microsoft | Telerik | ||
Presentation language | XAML and/or xamarin.forms | Proprietary but looks like XML | Proprietary but looks like JSX | Dart |
Procedural language | C# | JavaScript | JavaScript | Dart |
These are all decent options. All are free to develop in and are well-tested, having many production applications created. All have been used in large organizations.
But only one has an option to create a web application in addition to the iOS and Android apps that will be deployed to the app stores – Flutter.
Flutter is the latest of these frameworks to be released. As such it has a distinct advantage of observing those that had come before. The Flutter team took note of what worked well with other frameworks and what failed. In addition, Flutter added new innovations and ideas – all baked in from the start rather than being bolted on as improvements are made.
But I suspect that if you’ve bought this book, you don’t need much convincing so I’ll stop. Suffice it to say that Flutter is amazing! It is easy to write, elegant, well-designed – an absolute pleasure to code in.3
Conclusion
Now, if you’re the kind of developer I hope you are, you’re chomping at the bit to get your hands dirty writing some code! So let’s get to it. We’ll start by installing and learning the Flutter development toolchain.