setBadgeCount method

  1. @override
Future<void> setBadgeCount(
  1. int count
)
override

Sets the app icon badge count.

count must be a non-negative integer.

  • On iOS: requires notification permission with .badge enabled.
  • On Android: works only on supported OEM launchers.

Does nothing if the current platform is not Android or iOS.

Implementation

@override
Future<void> setBadgeCount(int count) async {
  if (!Platform.isAndroid && !Platform.isIOS) return;
  await methodChannel.invokeMethod('setBadgeCount', {"count": count});
}