DEV Community

Cover image for How to Customize and Change Your Flutter App Launcher Icon [2024]
Stephen Michael
Stephen Michael

Posted on • Originally published at axxellanceblog.com

How to Customize and Change Your Flutter App Launcher Icon [2024]

Hey there! Looking to give your Flutter app a bit of personality? Maybe that default launcher icon is just too “blah” for your masterpiece. Don’t worry! You’ve come to the right place. In this guide, I’ll walk you through changing the Flutter app launcher icon to something truly you.

And the best part? Even if you've never touched a line of code in your life, you can still follow along. We’ll go step-by-step, throw in some humor to keep things fun, and you’ll be showing off that shiny new app icon in no time. Let’s get into it!

Original source of this article can be found in Axxellanceblog

What is a Flutter App Launcher Icon? And Why Bother?

Alright, let’s start with the basics. In case you’re scratching your head, an “app launcher icon” is the small image you see on your phone screen when you open your list of apps. By default, Flutter gives you a generic icon – basically, the vanilla ice cream of app icons. But you want more, right?

Maybe your app is for coffee lovers, and you want a coffee cup as the icon. Or perhaps it's a cat app, and a cute little kitty face would be purr-fect (sorry, had to!). Customizing this icon makes your app stand out and gives users a taste of what they’re about to enjoy.

Step 1: Set Up Your Flutter Project

Alright, first things first – if you already have a Flutter project, you’re golden. If not, let’s get one set up quickly.

  1. Open a Terminal/Command Prompt: You’ll use this to run commands. (Yes, like those "hacker movies" where they type random code – but we’ll keep it simpler.)
  2. Create a New Project: Run this command:
flutter create my_cool_app  
Enter fullscreen mode Exit fullscreen mode

Replace "my_cool_app" with whatever you want to call your project.

  1. Open Your Project Folder:
cd my_cool_app  
Enter fullscreen mode Exit fullscreen mode

That’s it! You now have a Flutter app to work with. On to the fun part: designing your icon!

Note: Before the Flutter command can work, you will have to install flutter on your working pc, for some reference do check out the flutter documentation for more info @ Flutter.io.

Step 2: Create Your Custom Icon

You can’t customize your launcher icon without an icon, right? You can create one in any design tool, like Canva, Photoshop, or even Paint if you're feeling nostalgic.

Icon Requirements:

  • Size: 512x512 pixels is perfect.
  • Format: Save it as a PNG.
  • Design Tip: Keep it simple but unique! Icons are small, so avoid overcrowing with too many details.

Got your icon ready? Let’s put it in the app!

Step 3: Install the Flutter Launcher Icons Package

Now we’re getting into the real magic. Flutter has an amazing package called flutter_launcher_icons that does the heavy lifting for you – no need to go into each platform folder and change things manually (we’re not cavemen here).

Here’s how to install it:

  1. Open the pubspec.yaml file: This file is in your project folder and controls which packages Flutter uses.
  2. Add the package under dependencies:
dependencies:  
  flutter:  
    sdk: flutter  
  flutter_launcher_icons: ^0.9.2  
dev_dependencies:  
  flutter_launcher_icons: ^0.9.2  
Enter fullscreen mode Exit fullscreen mode
  1. Add configuration options to tell Flutter where your icon is and what to use it for:
flutter_icons:  
  android: true  
  ios: true  
  image_path: "assets/icon/icon.png"  
Enter fullscreen mode Exit fullscreen mode

Explanation time! Here’s what’s going on:

  • android: true and ios: true mean you want the icon for both Android and iOS.
  • image_path is the path to your icon file.
    1. Save and close pubspec.yaml.

Step 4: Add Your Icon File to the Project

Now you need to place your shiny new icon in the project folder.

  1. Create an Assets Folder: Inside your project directory, create a folder named assets and another folder within it named icon. Your path should look like this:
my_cool_app/  
└── assets/  
    └── icon/  
        └── icon.png  
Enter fullscreen mode Exit fullscreen mode
  1. Move Your Icon: Copy or move your custom icon file into that icon folder.
  2. Tell Flutter About Your Assets: Go back to pubspec.yaml and add the assets folder under flutter:
flutter:  
  assets:  
    - assets/icon/icon.png  
Enter fullscreen mode Exit fullscreen mode

Step 5: Run the Package to Apply the Icon

Almost there! Now we just need to run the flutter_launcher_icons package to apply your new icon.

  1. Open Your Terminal Again.
  2. Run This Command:
flutter pub run flutter_launcher_icons:main  
Enter fullscreen mode Exit fullscreen mode

If you see a success message and no errors, congratulations! You’re officially a custom-icon-crafting legend.

Step 6: Test Your Icon

You don’t want to go through all this only to find out your icon looks weird. Let’s test it out!

  1. Run the App on a Device or Emulator:
flutter run  
Enter fullscreen mode Exit fullscreen mode
  1. Check Your App Launcher: If all goes well, your new app icon should be there, loud and proud.

Troubleshooting Common Issues

Alright, things don’t always go perfectly. If you run into problems, here’s a quick list of common fixes:

  • App Icon Not Showing Up? Double-check your pubspec.yaml formatting. YAML is picky – if it’s even a little off, it won’t work.
  • Wrong Icon Size? Make sure your icon is 512x512 pixels. Small icons may look blurry or cropped.

Wrapping Up

And that’s it – you’ve done it! You customized your Flutter app launcher icon without breaking a sweat. Now, whenever you or someone else installs the app, they’ll see that unique icon and know it’s yours.

Customizing your app launcher icon might seem like a small touch, but it really helps set your app apart and gives it a professional polish. Plus, you did it all on your own! Now you can impress friends, family, and users with a unique app experience right from the start.

Now go forth and code – with style!

Top comments (0)