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 https://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:
assets:
- assets/icon/icon.png
- assets/icon/icon_2x.png
- assets/icon/icon_3x.png
- assets/icon/icon_4x.png
- Run the following command to update the Flutter app with the new icons:
flutter pub get
- Finally, specify the app icon in the
AndroidManifest.xml
file for Android and theInfo.plist
file for iOS. For example, in theAndroidManifest.xml
file, you would add the following line:
<application
android:icon="@mipmap/ic_launcher"
...>
Replace "ic_launcher" with the name of your app icon file.
That's it! Your Flutter app should now use the app icon that you specified.
Top comments (2)
Very well described. I was searching every where but this contant is mindblowing...@anurag629
Thanks @gurudayal123