Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
setBadgeNum(int count, BuildContext context) async {
try {
await FlutterDynamicIcon.setApplicationIconBadgeNumber(count);
} on PlatformException {
print('Exception: Platform not supported');
} catch (e) {
print(e);
}
// To get currently badge number that was set.
int badgeNumber = await FlutterDynamicIcon.getApplicationIconBadgeNumber();
// Quick alert box for acknowledgement
QuickAlert.show(
context: context,
title: 'Badge Number set as $badgeNumber',
text: 'Minimize the app to check it out!',
type: QuickAlertType.success,
confirmBtnColor: primaryColor,
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment