How to change your Flutter App Icon

with flutter_launcher_icons Package

Filip Doganowski
Nerd For Tech

--

Generated Image of a App Icon
Image generated by OpenAI’s DALL·E.

Introduction

In today’s competitive app market, standing out from the crowd is crucial for success. One effective way to make your Flutter app unique is by customizing its icon. Flutter provides a straightforward solution for this task with the flutter_launcher_icons package. This package simplifies the process of changing your app’s icon, allowing you to create a memorable first impression on your users. In this article, we’ll explore how to leverage the flutter_launcher_icons package to effortlessly change your Flutter app icon.

1. Installing flutter_launcher_icons

To use the flutter_launcher_icons package, add it as a dependency in your pubspec.yaml file :

dependencies:
flutter:
sdk: flutter
flutter_launcher_icons: ^0.13.1

or simply add it through the terminal :

flutter pub add flutter_launcher_icons

2. Adding assets

  • Create a folder named ‘assets’ in the root directory of your Flutter project.
  • Inside the ‘assets’ folder, create a subfolder named ‘images’ (or any desired name).
  • Place your app icon file (e.g., icon.png) inside the ‘images’ folder.
  • Add the assets path to your pubspec.yaml
flutter:
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/

3. Set up launcher icons configuration file

  • Create a new file named flutter_launcher_icons.yaml in the root directory of your project.
  • Add the following configuration options to flutter_launcher_icons.yaml:
flutter_launcher_icons:
android: "launcher_icon"
ios: true
image_path: "assets/images/icon.png"
min_sdk_android: 21 # android min sdk min:16, default 21
web:
generate: true
image_path: "assets/images/icon.png"
background_color: "#hexcode"
theme_color: "#hexcode"
windows:
generate: true
image_path: "assets/images/icon.png"
icon_size: 48 # min:48, max:256, default: 48
macos:
generate: true
image_path: "assets/images/icon.png"

Explanation of configuration options:

  • android: Specifies the name for the launcher icon for Android.
  • ios: Indicates whether to generate app icons for iOS.
  • image_path: Path to your app icon image file.
  • min_sdk_android: Minimum SDK version required for Android (default is 21).
  • web, windows, macos: Configuration options for web, Windows, and macOS platforms respectively.

If you don’t want the app icon to generate for a specific platform set:

  • android: false for android
  • ios: false for ios
  • generate: false for the web, windows & macos platforms

Be sure to set the correct image_path

4. Run the launcher

  • In the terminal, run the following command to update the app icons:
flutter pub run flutter_launcher_icons

This command will automatically update the app icons for your platforms based on the configuration specified in your pubspec.yaml file.

5. Conclusion

In conclusion, customizing your Flutter app icon using the flutter_launcher_icons package is a simple yet powerful way to enhance your app’s branding and user experience.

By following the steps outlined in this guide, you can effortlessly create a unique and memorable first impression on your users. Take advantage of this opportunity to showcase your brand identity and stand out in the competitive app market. Experiment with different icon designs, colors, and styles to find the perfect representation for your app.

--

--

Filip Doganowski
Nerd For Tech

Passionate Flutter Developer, Project Manager and Content Creator, visit my website: https://flutterdog.com