Flutter Tips 1

Series of tips and tricks related to Flutter mobile platform from Google

- December 5, 2021

Rest of the Story:

Tips and Tricks

  1. Create application icons via online resource for Android and IOS platforms

    android/app/src/main/res (copy all midmap)

    ios/runner/assets.xcassets (copy all files to this xcassets from the download from appicongenerator tool)

  2. Android recently starting putting round images around your uploaded icon. If you want to modify the uploaded icon you can manipulate with Android Studio (right clicking on android/app/src/main/res folder). See option New Image Asset? If you do not (like me), I had to perform the following steps in order to see this option.

    • Close Android Studio (for my Flutter project) then reopen the Android folder

    • Options were available to update Gradle (in my case from 4.x to 7.x), I chose yes.

    • Once finished this update, New Image Asset was option when I right clicked on the res folder (as a test I returned to my parent Flutter parent folder but did not have this option once again) So for me to see this Image Asset option I had to open with Android Studio the Android folder directly within my Flutter project.

  3. Use Android Studio Image Asset to resize icon's as desired to fit or fill the Android square, using the Scaling - Resize option in the dialog window.

  4. Developer resources

  5. If hot reload is not working for you, remember that it only works when you change something within a Stateful Widget.

  6. Null safety error messages

    "lib/main.dart:8:19: Error: Null safety features are disabled for this library. Try removing the package language version or setting the language version to 2.12 or higher. const MyApp({Key? key}) : super(key: key);"

    Open pubspec.yaml and change to sdk: ">=2.12.0 < 3.0.0"

  7. Ctrl-q shows quick docs within Intelli J