flutter_app_icon_badge 2.0.0 flutter_app_icon_badge: ^2.0.0 copied to clipboard
Flutter app icon badge plugin to change the badge on the icon of your app.
Flutter App Icon Badge plugin #
This Flutter plugin you can use to change the badge on the icon of your app
Supported platforms #
- iOS
- Android - some Android devices (the official API does not support the feature, even on Oreo)
- MacOs
- Windows - work in progress (need help)
- Linux - work in progress (need help)
Getting Started #
iOS #
On iOS, the notification permission is required to update the badge. It is automatically asked when the badge is added or removed.
Please also add the following to your Info.plist:
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
Android #
On Android, no official API exists to show a badge in the launcher. But some devices (Samsung, HTC...) support the feature. Thanks to the Shortcut Badger library, ~ 16 launchers are supported.
Dart #
First, you just have to import the package in your dart files with:
import 'package:flutter_app_icon_badge/flutter_app_icon_badge.dart';
Then you can add a badge:
FlutterAppIconBadge.updateBadge(1);
Remove a badge:
FlutterAppIconBadge.removeBadge();
Or just check if the device supports this feature with:
FlutterAppIconBadge.isAppBadgeSupported();
Another useful method in this plugin - detect if flutter desktop window in focus or not:
FlutterAppIconBadge.isAppBadgeSupported();