[Flutter] App icon

2021-06-20 hit count image

Let's see how to change the App icons in Flutter.

Outline

I try to develop an anpp with Flutter. In this blog post, I will show you how to change the App icons in Flutter.

To change the App icons, we need to generate the images for the Android and iOS, and configure them to each OS. However, if we use the flutter_launcher_icons package, we can configure the App icon more simply.

Prepare image file

First, we need to prepare an image for the App icons. The image should meet the following conditions.

  • PNG file
  • more than 1024px x 1024px size
  • 1024KB maximum file size

Store the prepared image to assets/app-icon.png.

Install flutter_launcher_icons

To use the flutter_launcher_icons package, of course, we need to install the flutter_launcher_icons package.

Execute the command below to install the flutter_launcher_icons package.

flutter pub add flutter_launcher_icons --dev

Configure App icon

Next, we need to configure the image for the App icons. Open the pubspec.yaml file, and add the code below to the bottom of the file.

...
flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/app-icon.png"

Generate App icon

Execute the command below to generate the App icons via the flutter_launcher_icons package.

flutter pub run flutter_launcher_icons:main

Check

When you restart your Flutter project, you can see the App icon changed well like below.

Flutter - App icon

Completed

Done! we’ve seen how to change the App icons in Flutter. You can change them simply when you use the flutter_launcher_icons package!

Was my blog helpful? Please leave a comment at the bottom. it will be a great help to me!

Posts