Flutter is getting more and more popular. Our team has several Flutter Developers and we’ve made multiple Flutter apps. Today, I wanted to share with you what we’ve learned along the way. Here’s the best tips for building apps in Flutter:
1. Avoid Costly Build Operations
One of the things that can greatly impact the performance of your Flutter app are build method operations. When building your app you should avoid any operations that require a lot of resources, memory and async calls. Those operations would be performed every time a tree would be rebuilt, slowing down your app.
2. Split Your Code Into Small Widgets
When building apps in Flutter, or any other technology for that matter, the readability and reusability is crucial. People need to be able to read the code you’ve written, in case the project is handed off to someone else or there’s a new developer joining the team. The reusability is also very important. It enables you and your team to be more efficient and effective when coding. So, write the code in the form of smaller widgets instead of large trees.
3. Avoid Absolute Positioning At All Costs
Absolute positioning is one of the worst things you can do when building apps. When coding for just one specific device, it can seem like absolute positioning is not that bad. However, when you’re building an app that’s meant to be released onto various different devices and operating systems – absolute positioning can really mess up the interface. Use values that adapt to the sizes of screens instead of absolute positioning whenever possible.
4. Use Effects Carefully
In older GPUs, drawing content into the offscreen buffer might trigger render target switches which can slow down your app. That’s why you should be careful with effects. Instead of using the ones that might trigger saveLayer(), you should consider using the ones that don’t. You can read more about that in this article by Google.
If you’re looking for a team of experts when it comes to building apps in Flutter – contact us and let’s get your project started!