app_badge_plus 1.1.2 app_badge_plus: ^1.1.2 copied to clipboard
A Flutter plugin for adding badges to your app icon.
app_badge_plus #
A Flutter plugin for adding badges to your app icon.
Supported Platforms`` #
- iOS
- Android
- Samsung (pass)
- Oppo (pass)
- Vivo (pass)
- Huawei (pass)
- Xiaomi
- LG
- Sony
- HTC
- ZTX
Mark #
Android #
Starting with Android 8.0 (API level 26), notification badges—also known as notification dots—appear on a launcher icon when the associated app has an active notification. Users can touch & hold the app icon to reveal the notifications, along with any app shortcuts.
https://developer.android.com/develop/ui/views/notifications/badges
Starting With Android13 (API level 26), notification runtime permission should be requested before setting app badge.
iOS #
On iOS, notification permission is inneed.
permission_handler #
Using permission_handler package to manager permission on Android and iOS.
https://pub.dev/packages/permission_handler
Usage #
To use this plugin, add app_badge_plus
as a dependency in your pubspec.yaml file.
dependencies:
app_badge_plus: ^1.0.0
Example #
import 'package:app_badge_plus/app_badge_plus.dart';
// Set badge
AppBadgePlus.updateBadge(5);
// Remove badge
AppBadgePlus.updateBadge(0);
// Whether the launcher support badge, it always return true on iOS, and on Android it will return false if the launcher doesn't support badge.
AppBadgePlus.isSupported();
Compare #
flutter_app_badger #
https://pub.dev/packages/flutter_app_badger
Set badge
FlutterAppBadger.updateBadgeCount(1);
replace to
AppBadgePlus.updateBadge(1);
Remove badge
FlutterAppBadger.removeBadge();
replace to
AppBadgePlus.updateBadge(0);
Device support
FlutterAppBadger.isAppBadgeSupported();
using dart api:
Platform.isAndroid || Platform.isiOS