flutter_native_badge

Last updated:

0 purchases

flutter_native_badge Image
flutter_native_badge Images
Add to Cart

Description:

flutter native badge

flutter_native_badge #
Wrapper for native badge APIs on iOS and macOS. It allows you to change the badge of your app icon, by setting the count, showing red dot, clearing the badge and getting the current badge count.
It supports iOS and macOS for now. Other platforms are not supported yet.
Preview #



Ios App
MacOs App









Usage #
Before using any of the methods, you should check if the platform is supported. If not, the methods will throw an unsupported exception.
Each method will check if the permission is granted if you set the requestPermission parameter to true. If not, it will not request the permission and the method may not work if the permission is not granted.
Import #
import 'package:flutter_native_badge/flutter_native_badge.dart';
copied to clipboard
Check if the platform is supported #
bool isSupported = await FlutterNativeBadge.isSupported();
copied to clipboard
Set badge count #
FlutterNativeBadge.setBadgeCount(5);
copied to clipboard
Show red dot #
FlutterNativeBadge.showRedDot();
copied to clipboard
Clear badge count #
FlutterNativeBadge.clearBadgeCount();
copied to clipboard
Get badge count #
int badgeCount = await FlutterNativeBadge.getBadgeCount();
copied to clipboard
For iOS: getBadgeCount depends on deprecated API and could be unavailable in future iOS releases!
There aren't any replacements in iOS SDK.
If you use getBadgeCount now, you had better to consider how to manage the count yourself.
Request permission #
Each method has a requestPermission parameter. If you set it to true, it will request the permission if it is not granted.
FlutterNativeBadge.setBadgeCount(5, requestPermission: true);

FlutterNativeBadge.showRedDot(requestPermission: true);

FlutterNativeBadge.clearBadgeCount(requestPermission: true);

int badgeCount = await FlutterNativeBadge.getBadgeCount(requestPermission: true);
copied to clipboard
Contributing #
Contributions are welcome! Please follow the Flutter & Dart standard and make a PR.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.