Flutter App Badger plugin #
This plugin for Flutter adds the ability to change the badge of the app in the launcher. It supports iOS and some Android devices (the official API does not support the feature, even on Oreo).
Getting Started #
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>
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.
First, you just have to import the package in your dart files with:
Then you can add a badge:
Remove a badge:
Or just check if the device supports this feature with:
[1.1.2] - 15th December 2019
- Support the new plugin pubspec format
- On Android, the custom dependency to ShortcutBadger is removed, since unused
[1.1.1] - 3rd December 2019
- Migration of the sample to Android X
[1.1.0] - 11th November 2019
- Migration to Android X (thanks to orknist) + Android Target SDK = 29
[1.0.3+2] - 13th September 2019
- README updated
[1.0.3] - 25th June 2019
- Android: Migration to the latest version of the ShortcutBadger library (1.1.22)
[1.0.2] - 5th July 2018
- Android: Include the PR #268 to support Oreo devices.
[1.0.1] - 10th April 2018
- Fix a bug with the Android build.
[1.0.0] - 10th April 2018
- Initial Release.
Demonstrates how to use the flutter_app_badger plugin.
Getting Started #
For help getting started with Flutter, view our online documentation.
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: flutter_app_badger: ^1.1.2
2. Install it
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Feb 12, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.7.1
- pana: 0.13.5
- Flutter: 1.12.13+hotfix.7
Health issues and suggestions
Document public APIs. (-1 points)
6 out of 6 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.