Today we will be discussing how to change the application launcher icon on flutter. Since flutter launcher icons are designed to create launcher icons for both Android and iOS automatically, sometimes a user can go into an issue and may not be able to change the launcher icon.
If you have created the app with the flutter create command then you might run into a possibility of confusion that how to change the launcher icons for both the android and iOS applications. All you have to do is follow the below steps to get the launcher icons changed on flutter.
Steps to Change Launcher Icon on Flutter
Flutter Launcher icons are generated automatically which is as per the design of flutter to help users and minimize the time taken for launcher icons creation.
There is a package called Flutter Launcher Icons, It is fully flexible, will allow you to choose what platform you want to update the launcher icon for, and if you want to change the option to keep your old launcher icons will be provided. So, that you would be able to revert to the old launcher icon in case you want to do so.
- So, add this package Flutter Launcher Icons to your pubspec.yaml file (within your flutter project) to use it.
- Specify the path of the new icons you are willing to use in pubspec.yaml.
- Run the package
- After its completed, the default launcher icons will be removed with your custom icon.
1. Setup the config file
Once you have added the
Flutter Launcher Icons configuration to your
pubspec.yaml or if you have created the config file called
flutter_launcher_icons.yaml as displayed below example. More complex examples can be found in the example projects.
dev_dependencies: flutter_launcher_icons: "^0.8.0" flutter_icons: android: "launcher_icon" ios: true image_path: "assets/icon/icon.png"
If you name your configuration file something other than
pubspec.yaml you will need to specify the name of the file when running the package.
flutter pub get flutter pub run flutter_launcher_icons:main -f <your config file name here>
Note: If you are not using the existing
pubspec.yaml ensure that your config file is located in the same directory as it.
2. Run the package
After you have completed setting up the configuration, all that is left to do is run the package.
flutter pub get flutter pub run flutter_launcher_icons:main
If you encounter any issues please report them here.
In the above configuration, the package is set up to replace the existing launcher icons in both the Android and iOS project with the icon located in the image path specified above and given the name “launcher_icon” in the Android project and “Example-Icon” in the iOS project.
You can watch the below video for more information:
That’s all for today’s question on how to change the application launcher icon on flutter. It’s really using the above package and it has a proper video tutorial made by the person who has created this package. You can also read the complete guide related to the package present on the flutter package website.
If you liked the answer then please follow us on Facebook and Twitter. Let us know the questions and answer you want to cover in this blog. Please feel free to read more articles related to Flutter, also subscribe to our newsletter to never miss an update related to flutter.