Search code examples
androidflutterdart

Replacing app launcher icon in flutter with new icon


I was looking for changing the app icon of my current app. I cane around the package name flutter_launcher_icons.

I also found I can do by putting an image in mipmap-xxxhdpi in android/app/res folder. And it works.

So my question is why we need additional package(flutter_launcher_icons) for this.


Solution

  • When you use the package flutter_launcher_icons it will automatically generate different icon sizes for the app which is better than just putting an image in mipmap-xxxhdpi in android/app/res.

    Example, if you add flutter_launcher_icons to the pubspec.yaml:

    dev_dependencies: 
      flutter_launcher_icons: "^0.7.3"
    
    flutter_icons:
      android: "launcher_icon" 
      ios: true
      image_path: "assets/icon/icon.png"
    

    Then execute the following:

    flutter pub get
    flutter pub run flutter_launcher_icons:main
    

    It will generate all the icons under different sizes in the res folder for android and Assets.xcassets for ios.

    Check here for more information:

    https://github.com/fluttercommunity/flutter_launcher_icons