Search code examples
flutterdartcounterbadge

Badge counter on launcher icon in flutter


I am trying to implement badger count on app launcher icon in flutter for all android based devices. I've tried flutter_app_badger and flutter_dynamic_icon as well but both of them aren't compatible with android. I wan't a unamious solution it's awesome if it works both for android or ios as well. I am trying to find solutions but there isn't enough data present. Onesignal push notification I am using for the app provides default badge count but it's not in all devices either. Please help me with the situation.

setLauncherNumber()async{
  // set batch number
  try {
    print('LauncherBadge inside try');
    // FlutterAppBadger.updateBadgeCount(10);
    await FlutterDynamicIcon.setApplicationIconBadgeNumber(93);
    print('LauncherBadge Success');
  } catch (e) {
    print('LauncherBadge error $e');
  }
}

flutter_app_badger and flutter_dynamic_icon arent compatible with all devices


Solution

  • Use this package flutter_app_badger: ^1.5.0

    import 'package:flutter_app_badger/flutter_app_badger.dart';
    
    FlutterAppBadger.updateBadgeCount(1);
    

    enter image description here