flutter_native_badge 1.0.5 copy "flutter_native_badge: ^1.0.5" to clipboard
flutter_native_badge: ^1.0.5 copied to clipboard

PlatformiOSmacOS

Flutter plugin for setting the badge count on native platforms. Wraps the native APIs for iOS and macOS to set the badge count on the app icon.

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';

Check if the platform is supported #

bool isSupported = await FlutterNativeBadge.isSupported();

Set badge count #

FlutterNativeBadge.setBadgeCount(5);

Show red dot #

FlutterNativeBadge.showRedDot();

Clear badge count #

FlutterNativeBadge.clearBadgeCount();

Get badge count #

int badgeCount = await FlutterNativeBadge.getBadgeCount();

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);

Contributing #

Contributions are welcome! Please follow the Flutter & Dart standard and make a PR.

7
likes
130
pub points
72%
popularity

Publisher

unverified uploader

Flutter plugin for setting the badge count on native platforms. Wraps the native APIs for iOS and macOS to set the badge count on the app icon.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_native_badge_foundation, flutter_native_badge_platform_interface

More

Packages that depend on flutter_native_badge