Five Tips for the New Flutter Developer
Updated: Nov 21, 2020
Tip 1: Create separate classes to handle your backend services.
One of my favorite practices to implement in my own development is to create separate classes solely dedicated to service handling. By doing this, you can consolidate your database or authentication code (or whatever other service you are using) into one or two files. Then, if you encounter a bug in the development process related to a specific service, you will no exactly where to start looking. It's very easy to just put service code in your pages due to the structure of widget trees, but by doing this the code becomes harder to read.
Tip 2: Learn Asynchronous programming
The hardest challenge for me to overcome when building my first app was learning what asynchronous programming is and how it works. Essentially, asynchronous programming refers to any method that relies on another, typically remote, service to complete. Because it takes time for the software to retrieve data from the cloud, these functions actually complete later than everything else in the method. I highly recommend reading the documentation on the Future object and its associated widgets before starting your app.
Tip 3: Plugins are your best friend
Does your app need a component that would take ages to code from scratch? If so, there's a plugin for that. Flutter has a wonderful community of developers who are constantly building tools that you can use in your apps. While not every plugin is free to use, a good chunk of them are, and they easily integrate into your app. In fact, most of the plugins on pub.dev, the leading site for Flutter plugins, have step-by-step guides on how to install and use the plugin.
Tip 4: Choose the right IDE
Flutter has a ton of development functionality, and is compatible with a variety of coding styles. You can run and develop an app entirely from your CLI, use a text editor/CLI combo, or work with Flutter in a fully integrated IDE. I personally develop in Visual Studio Code because I found that Flutter integrates well there after initial setup, but have also used a CLI for debugging.
Tip 5: Be aware of what devices you are building for
I'm including this tip because at the start of my mobile dev journey, I had no idea that building for Android and building for iOS were two completely separate processes. If you intend to build an app for only Android, this doesn't matter as Android Studio is available for all operating systems. However, if you want to develop for iOS, you need access to XCode, which is only available on a Mac. You can still create the source code, but Flutter compiles iOS apps with Swift. So, in order to get your app on actual devices, XCode is a must.
Hopefully these tips will help you as you begin the journey of becoming a mobile developer. It can be extremely rewarding, especially seeing your app on someone's device for the first time. If you'd like to hear more about coding for college students, join my mailing list to stay up to date on new articles.