0

I want to know if there is any way to implement something like a selector where users can select an icon for the app and change the app icon depending on their selection. I remember that Instagram for example implement something like that in one of their anniversary, is there any way to do something like that in Flutter ?

1 Answers1

0

Yes, you can change the app icon dynamically. However, only for the iOS as of now.

Package: Flutter Dynamic Icon

Sample Code:

import 'package:flutter_dynamic_icon/flutter_dynamic_icon.dart';

try {
  if (await FlutterDynamicIcon.supportsAlternateIcons) {
    await FlutterDynamicIcon.setAlternateIconName("photos");
    print("App icon change successful");
    return;
  }
} on PlatformException {} catch (e) {}
print("Failed to change app icon");

...

// set batch number
try {
    await FlutterDynamicIcon.setApplicationIconBadgeNumber(9399);
} on PlatformException {} catch (e) {}

// gets currently set batch number
int batchNumber = FlutterDynamicIcon.getApplicationIconBadgeNumber();


Note: You shold check first to see if platform supports dynamic icons or not using await FlutterDynamicIcon.supportsAlternateIcons boolean check and then try to change the icons.

Ariel
  • 2,471
  • 1
  • 26
  • 43