10 Flutter tips part — 4/10
We’re almost halfway through the series, and today we’re looking at some really important things in Flutter, like version management, json formatter, and other things!
If you haven’t seen the first 3 parts yet, you can catch up here:
Running multiple emulators to test if the app is responsive was yesterday’s news. Fortunately there is device_preview, with which you can switch between devices in your emulation very fast.
Flutter Version Management, or fvm for short, is a must for your Flutter setup. When a new Flutter version is out, you like to test something or even upgrade your current app and then all your code is broken and doesn’t work anymore. To manage Flutter versions and have several on your computer at the same time, you should use fvm.
You can install it easily like this:
dart pub global activate fvm
Flutter Sidekick is from the same developer, so it’s perfect for combining Fvm and Sidekick. Flutter Sidekick is an app where you can do a lot of things. You have there a project overview of all your projects, where you can then change the version with 2 clicks, without complicated changing anything in the pubspec.yaml. In addition, you can quickly download from over 430 versions (as of July 18, 2021) and even see what Flutter version 0.1.6 already had.
Intl is a must for every Flutter project. It provides internationalization and localization features, message translation, plurals and genders, date and number formatting and much more!
Almost every project needs data classes and toJson and fromJson methods. With Quicktype you can quickly convert a Json format into a data class in many programming languages, including Dart.
Google Maps for Flutter
The package google_maps_flutter is actually self-explanatory. It gives you a widget for Google Maps, with which you can do various things. For example, you can navigate to different places and much more.
With the connectivity package you can easily see if the user is connected to the internet via Wi-Fi, mobile data or not at all. This way you can, without producing errors, display appropriate widgets for it, maybe that he can’t download this now because he has disabled that he can do this with mobile data or a screen is displayed that you don’t have an internet connection at all.
When developing an app, sometimes the app needs to access the photos, files Camera or even the microphone. With the plugin permission_handler you can easily ask for these permissions.
share_plus is a community-created package that lets you share content from the Flutter app on a variety of platforms. It is very easy to use:
Flutter Local Notifications
As the name flutter_local_notifications says, with this plugin you can send notifications on Android, iOS and macOS.
You have numerous features and can schedule notifications, show them periodically and much more. With the notifications themselves, you can also set a lot of things. You can set the title and body, set the default icon for notifications and perform a function when the user clicks on the notification.
And now we are almost at the half of the series.
In this post we have covered some really important tips, which you should definitely check out! If you have any questions or suggestions for improvement, feel free to write them in the comments!