- One Year with Flutter: My Experience
- By Nick Manning
- The Nuggets translation Project
- Permanent link to this article: github.com/xitu/gold-m…
- Translator: ssshooter
- Proofreader: Shixi-Li, MirosalvaSun
It’s been a good year for Flutter.
Almost exactly a year ago, I wrote an article entitled “Why Flutter will Take off in 2018”. Although Flutter went through almost the entire beta phase of 2018 to reach its current version 1.0, its community and product has grown rapidly in the process, and Flutter is now ranked in the Top 20 of GitHub repository Star. This article introduces my one-year experience of using Flutter and the advantages and disadvantages of Flutter that I found in this process.
What I’ve done with Flutter in the past year:
- I used Flutter to rewrite an iOS App that had previously been available on the App Store.
- Release a free crash course on Flutter, recording over 5 hours of teaching videos.
- There are several small apps developed with Flutter that have not yet been released.
Before I list my ideas, let me give you a little background on my technology. I’m iOS developer for mobile development. In addition, I also used React Native extensively in my daily work last year. I’m not going to compare Flutter to any of these technologies, but these mobile development experiences do affect my impression of Flutter.
Then, here’s what I’ve learned from using Flutter for a year:
1. Dart is easy to learn and enjoyable to use
Dart is easier to learn and has simpler syntax than TypeScript and Flow, which I used extensively in React Native development last year. I was able to develop applications efficiently with a reliable compiler that had clear, well-defined error messages and few unexpected hidden runtime errors. If enough people want to know about it, I’ll write a more detailed example comparison. What I’m saying is that developers should consider strongly typed languages, even for medium-sized applications, because they save a lot of time for fast development and reliable code.
2. Sometimes you Still need to “do It yourself”
Another common situation involving new technology is the need to “do it yourself” to write a library to connect to third-party services. For example, to use Mixpanel to analyze my application (because they generously gave it away with a free package and their UI was simple and clear), I had to wrap a library of my own: pure_mixpanel, which wasn’t hard, and it was fun.
I found good practice using scoped_model because it does a good job of removing the use of streams, much like the React Context API that was just updated. You can cleanly separate business logic from rendering logic, and it’s very easy to learn.
3. The architecture and state management model is still immature
Flutter is a new technology, so it is still difficult to get adequate advice on practices, architectural patterns, and state management. Some follow the “BLoC” (Business Logic Component) model. I haven’t decided to use it yet because I think it’s a bit too complicated. There’s also RxDart and Redux for Flutter, which I haven’t used yet because they also seem too cumbersome. Android or React engineers, on the other hand, seem to have a lot of success, probably because they’re used to it.
I think the whole ecosystem will mature in 2019 as more and more people are writing more complex Flutter applications.
4. Thermal overloading is important
There is not much to say about this, but the property of Flutter is important enough to add this section to this article. The Flutter is thermally reloaded faster and more reliable. I can’t say the same about thermal reloading of other technologies (tell myself I don’t hack other technologies).
5. Cross-platform design is not easy
Material Design is beautiful and allows us to get off to a fast start. It’s obviously a good choice for some types of Web apps and Android apps, but showing it to iOS users is not a good idea unless it’s a Google app or something very simple. IOS users are used to CocoaTouch style UX.
“Write once and run anywhere,” custom custom designs, and the introduction of common design elements (for example, TAB bars) are becoming more common. Although Flutter does provide a large number of ios-style widgets, in order to make the code maintainable, most people will use the Material Design library that encapsulates a custom Flutter, which is easy to implement.
I’ll write another article on this topic, but my advice is to stick with Material Design and try to make those iOS users feel less “Android” in some ways. In the case of forms, form fields using the Material Design style are familiar enough to both types of users.
6. Implementing complex layouts in Flutter is simple
I’m used to using libraries like React, CSS Grid, Flexbox, etc. The layout of Flutter borrows a lot from these libraries. If you are already familiar with these Web-based layout concepts, learning the Flutter layout will be easy. Even if you don’t know Web layout, it’s still simple. If you want to get a feel for how Flutter is laid out, you can watch this video.
In addition, the UI logic in Dart and Flutter is excellent from a code readability perspective. Overall, I personally prefer this layout to JSX. It reminds me of the simple layout logic in Swift and iOS (if you do it programmatically).
7. Still need to pay more attention to the end-to-end application examples
There is plenty of solid documentation, tutorials, communities, and help with other Flutter users, but there is too much emphasis on widgets. This was necessary when Flutter first came out. But eventually, more and more people are starting to write more and better applications than just implementing pure UI and animation, and I think the Flutter website should feature more end-to-end tutorials. That’s the main reason I started my own course website.
I learned to write a Flutter application that wasn’t limited to just using controls. There are many more advanced Dart features that I find very useful, and you have to dig into them. The architectural patterns I mentioned are also worth exploring. Finally, integrating Web services with other Dart best practice integrations still requires more documentation and tutorials.
8. For my next project I’ll use GraphQL or gRPC
I always strive for less template code. While some tools have solved my problems in some simple projects, I think I’ll use GraphQL or gRPC for my next project. I think the investment in both is worthwhile. As for gRPC, I don’t recommend it for smaller projects, but for medium to large projects, once you use it, you love it. GRPC worked well on one of my Swift projects and has been in production for several years.
9. Submitting applications on both platforms is simple
It takes a while to get used to the tools and steps required to submit your app for each platform (especially Google Play store and iTunes Connect), but it’s pretty simple. I would say submitting apps for iOS is definitely more on the learning curve.
10. Flutter has too many widgets
Of the controls I thought I needed to learn about Flutter application development, ONLY about 20% were actually used. For example, in a Center Widget, why do you need a control that has the sole function of centering child controls? While it makes it easy for novices to learn, widgets can generate too much nested Dart code when implementing complex layouts. Instead, I’ll go back to the basic Container layout because it’s more flexible.
My advice is to focus on simple, basic widgets first, and then learn about other widgets when you really need them.
11. I’m moving from Firebase (except for push notifications)
Firebase seems like a great product. It reminds me of Parse back in the day. Firebase is a good choice for simple projects, or when you’re about to turn the project over to a client that doesn’t have enough backend technicians.
But in reality, most products already have backends in place, or technical teams write their own. This is true for large companies or even startups.
For indie developers or small groups, what happens to your monthly Firebase bill if your traffic surges? That’s the main reason I avoid Firebase. What if my app goes viral and Firebase asks me for money?
Please note that MY career is writing back-end systems, so this is just my opinion. I still recommend Firebase if you’re a junior developer who wants to deliver a simple back end to a client, or if you just don’t want to write a back-end API.
12. Documentation of Flutter is getting better and better
Widgets and class documents now have more and more examples (for example). This is a huge advantage over other libraries that lack proper examples, let alone well-documented ones.
In addition to documentation, I’ve had plenty of enthusiastic and knowledgeable people on Stack Overflow last year offering technical support.
13. You can use Flutter even if corrupted by iOS development
I’ve been an iOS engineer for years, so I’m a bit spoiled by iOS development. Not just documentation and support, but the overall quality of the iOS ecosystem, from libraries to Xcode to the way the CocoaTouch SDK is organized.
The Flutter also fits my previous experience. It’s also very simple, while taking into account the simplicity of some React Native components like ListView (friends, have you ever used iOS UITableViewController? Yuck) so in general, learning and using Flutter will be very smooth with mature tools to work with it. The fact that you don’t need a tool as complex as Xcode is a real eye-opener.
14. I’m not going back to single-platform development
Game developers will probably never write one set of code just for one platform. With React Native and Flutter, “non-game developers” could do the same.
In my free time, for example, I work on small, husband-and-wife projects, writing apps with my UX designer wife. Flutter reconfigured the iOS app to double its user base, and now that it is available on both platforms, I would definitely not consider going back to a single platform.
Final thoughts
A year from now, when I start writing the next Flutter application (a video documenting the development will be posted later!) I am still very happy that I invested my time in learning Flutter. I can’t go back to the old development mode now. It makes sense for an enterprise to be a viable option for multi-platform writing techniques, and it’s fun to use cross-platform techniques as a developer. This, coupled with web Flutter technologies such as Hummingbird and Google’s long-term commitment to Flutter for the new Fuschia operating system, shows that Google is serious about this technology.
Feel free to contact me on Twitter. And if you’re interested, check out my free Flutter course on Fluttercrashcourse.com!
2019 programming happy!
If you find any mistakes in your translation or other areas that need to be improved, you are welcome to the Nuggets Translation Program to revise and PR your translation, and you can also get the corresponding reward points. The permanent link to this article at the beginning of this article is the MarkDown link to this article on GitHub.
The Nuggets Translation Project is a community that translates quality Internet technical articles from English sharing articles on nuggets. The content covers Android, iOS, front-end, back-end, blockchain, products, design, artificial intelligence and other fields. If you want to see more high-quality translation, please continue to pay attention to the Translation plan of Digging Gold, the official Weibo, Zhihu column.