Flutter – When the user creates a project, by default flutter icon will be a launcher icon. To publish your App to the Google Play Store and Apple App Store, you need to change the default icon. In this tutorial, you will learn how to change the application launcher icon in a flutter. To change the app display name, also check this post.
There are two methods to change the app launcher icon.
- Using package to changing app icon.
- Mannually changing the app icon.
Using package to changing app icon in flutter
By using this method, the flutter_launcher_icon will automatically create all different size icons for your app. Follow these steps,
Step 1: Navigate to go pubspec.yaml file.
Step 2: Add the flutter_launcher_icon package under dev dependencies.
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.9.1
Step 3: If you don’t have an asset folder in your project. Then, create an asset folder in the root directory. Inside the assets folder, create the icons folder and place the app icon in the icon folder.
In the pubscec.yaml file, uncomment the assets:
in the flutter section and add your icon path. For example,
flutter:
uses-material-design: true
assets:
- assets/icon/icon.png
Step 4: After setting pubspec.yaml file configuration, then run the following command in vs code terminal or android studio terminal.
flutter pub get
flutter pub run flutter_launcher_icons:main
That’s all.
Manually Changing App Icon in Flutter
Step 1: Go to the https://appicon.co/ and upload your own icon.
Step 2: Select the iPhone, iPad, and Android. then click the generate button. Now a zip file will be downloaded.
Step 3: Extract the zip folder. You will see the two folders namely Android and Assets.xcassets.
Step 4: Changing app icon for both android and iOS.
For Android,
- Open the AppIcons\Android folder and copy all the sub folders. Then go the android\app\src\main\res folder and paste it (replace the existing file to new file).
For iOS,
- Open the AppIcons folder and copy the Assets.xcassets folder. Then go the ios/Runner and paste it (replace the existing file to new file).
Step 5: After changing icons, run the flutter run
command.
That’s all.