These 4 Flutter Hacks Will Change How You Code Today.
Master these 4 Flutter hacks and watch your coding efficiency take off — perfect for developers looking to level up fast!
Today, I’m going to present you 4 extremely useful flutter tips that you can immediately apply to your project. I won’t present you any packages or extensions, as I usually do, but very simple, but extremely useful tips!
Happy reading!
Easier Assets Management
Managing assets can be very hard. If you want to use an image several times in your app, you have to specify the path again and again. But there is a much easier solution for this. Create an App Assets class where all your app assets are stored. Now you can easily call your assets with AppAssets.appLogo
or AppAssets.noConnection
.
class AppAssets {
static const String appLogo = 'assets/images/app_logo.png';
static const String noConnection = 'assets/images/no_connection.png';
}
import 'app_assets.dart';
Image.asset(AppAssets.appLogo),
Easier imports
Seeing and managing thousands of imports at the beginning of a file is annoying. That’s why I’ll show you a way to reduce your imports with ease.