6 Reasons Why You Should Try Flutter as an iOS Developer
By: Kamil Powałowski
Tags: App Development, Flutter, iOS, Mobile, Development

Flutter may be the best thing that happened to the mobile development scene in the recent past. It allows me to work faster, and more conveniently, and believe me, it might do the same for you.

So, are you an iOS Developer like me? Yes? Have you befriended a new kid on the block called Flutter? The 1.0 release of this Google-made framework was up in December 2018, but it’s moving forward really quickly.

If you haven’t tried it yet, I encourage you to do so. It’s a fantastic framework — it challenges both existing cross-platform frameworks, as well as native platforms, to become better. To make your decision easier, I gathered a list of features, that in my opinion, put Flutter above other tools used for iOS development.

1. Material Design: Making Prototypes Becomes Easy

I was born to become an iOS developer. Apple products and design made me a little biased towards Apple, and I prefer their UI design over Material Design.

However, I must admit that making good looking apps and prototypes is much easier with Material Design. At least for non-designers like me. This drives me to the first advantage of Flutter — it has dedicated widgets for most of the Material elements. A widget is a basic component used to build UI in Flutter. You can think about widgets, like about UIViews in iOS.

10Clouds’ designers working on one of the projects

Take a look at a gallery of widgets provided by the Flutter team. With a little help from official documentation, you can easily create prototypes that are easy to use and follow the best industry practices. Of course, you are not tight to Material design. Some widgets from a package called Cupertino recreate iOS components.

2. Android Studio: A Great Tool for… iOS Developer

This may be a bold statement, but I think that AppCode is a way better IDE than Xcode. It comes from JetBrains, a company focused specifically on making developers lives easier. If you are familiar with one of their IDE (like WebStorm or AppCode) you will know how to use the rest of them — you can switch from AppCode to Android Studio in no time which is a real time saver when you work on iOS and Flutter application during the same day.

Android Studio works great with Dart and Flutter. Code completion is quick, and syntax highlighting always work. You have great shortcuts for wrapping and unwrapping widgets, renaming and method extracting. There is also one handy keyboard shortcut (Cmd+D) which duplicates a line of code. What a great piece of software! If you really don’t like Android Studio, there is a solution for you as well. You can use a designated plugin for Visual Studio Code.

3. Hot Reloading: See the Changes Instantly

You make adjustments in application UI, and compile Swift application. It takes a long time, so you start working on next thing (like this one from XKCD). Then the application runs, and you forgot what you actually changed. Sounds familiar? When the iOS project grows, compilation can take a lot of time. It is a serious issue. We have to wait for our application, we lost a lot of time, and we can be easily distracted during that time.

Waiting, and waiting…

Photo by NordWood Themes on Unsplash

Dart, language that we use to write Flutter applications, has a solution for this. It can compile in two modes. Ahead-of-time (AOT) compilation is used when you build an app for production. It takes more time but compiles binary works faster. Just-in-time (JIT) is used when you are developing the application. JIT compilation allows you to see your changes instantly which speeds up development cycles. This feature is often called hot reloading. No more, „app is compiling” excuses in Flutter!

4. Dart: As Easy as It Gets

When the first versions of Swift appeared I was a bit skeptical. Objective-C seemed to be a very good language and developing apps in it was a pleasure. But then I fall in love with Swift. Code that takes 100 lines in both Objective-C files can be written in Swift in 50 lines (or less) in one file! And all that functional programming functions. Oh boy, what a blast.

When I started learning Flutter, the first thing I noticed was Dart’s simplicity

But then Swift started to change, and I have a feeling that these changes are not taking us in the right direction. I’m expecting a modernization of UIKit not KeyPath and dynamicCallable in Foundation. I think they make code less readable. When I started learning Flutter, the first thing I noticed was Dart’s simplicity. No classes in other classes. Simple numeric enums, async/await keywords, easy access control, and a great code formatting. We discussed it in our 10Clouds mobile team, and I said that even a toddler that knows any object-oriented programming language could easily read code written in Dart.

5. Explicit File Import: Bye, Bye, Traumatic Naming Experiences

I’m bad at naming. I named my last macOS application Countdowns. It is a pretty popular word, so obviously I can’t monitor the publications that are mentioning it. In fact, it took me a week to find out that it was featured on Lifehacker.

Swift forces me to give every class and struct in the project different name. Finding a valid name for n-th kind of button that is used in the code may be a traumatic experience. The reason for this is simple — all not “private” and “fileprivate” objects are visible in all files of the Swift module. A solution used in Dart, where you have to explicitly declare what files are you importing allows me to give classes shorted, and still fully understandable names. This also has some disadvantages — you may land with long import list on top of your source code file. But you can fight with that by making listing files that export your interface.

6. No Threads, Fewer Problems

Threads or Dispatch Queues are a great invention to separate our UI code from operations that can be executed in the background. Except they are not. When using threads, we can encounter many problems. Especially when we work with properties that are used between threads. This is like in this old programmers joke: `Some people, when confronted with a problem, think “I know, I’ll use multithreading”. “Nothhw tpe yawrve o oblems”`.

Dart took a different approach that works great in JavaScript — it’s single threaded. Of course, it doesn’t mean that we can’t do an asynchronous task. We can, but with a help of async/await, or by Futures and Streams. For more advanced users there is also thread-like support called Isolate. These internal workers don’t share a memory, so we don’t have to worry about race condition.

A Serious React Native Competitor

I hope those arguments made your mind up a bit, and you will at least check Flutter’s docs. At 10Clouds we believe that Flutter can be a serious competitor to React Native. It proved to be less error-prone and platform agnostic than RN in our projects. With Flutter Web on the horizon, we will be able to share code with the web as well, which is one of the biggest selling points for RN right now.

Additionally, Flutter is blazing fast. It can be a remedy for React Native UI quirks, and from my experience, it’s proven to be production ready in multiple use cases. And last but not least, from a developer perspective, it’s just fun to work with.

At 10Clouds, we develop outstanding mobile apps. Check out our mobile services website to get more details or just contact us. From business consulting, through choosing the right technology, to delivering perfect code, our team will make the best use of its wide skills to make your product successful.