To add an app icon to a Flutter mobile app, follow these steps:
Create a new folder in the root of your Flutter project called "assets". This is where you will store your app icons.
Add your app icons to the "assets" folder. Make sure to include versions of the icon for different screen densities, such as 1x, 2x, 3x, and 4x. You can generate these versions using a tool like makeappicon.com.
Open the
pubspec.yaml
file in the root of your Flutter project. This file contains the configuration for your Flutter app, including the assets that it uses.Under the "flutter" section, add an entry for each of your app icons to the "assets" list. For example:
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon.png"
- Run the following command to update the Flutter app with the new icons:
flutter pub add flutter_launcher_icons
flutter pub get
flutter pub run flutter_launcher_icons:main
Now hot reload the app. That's it! Your Flutter app should now use the app icon that you specified.