Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/g123k/flutter_app_badger

Support to update the app badge on the launcher (both for Android and iOS)
https://github.com/g123k/flutter_app_badger

android badge dart dartlang flutter ios launcher

Last synced: about 2 months ago
JSON representation

Support to update the app badge on the launcher (both for Android and iOS)

Lists

README

        

# Flutter App Badger plugin

[![Pub](https://img.shields.io/pub/v/flutter_app_badger.svg)](https://pub.dartlang.org/packages/flutter_app_badger)

This plugin for [Flutter](https://flutter.io) adds the ability to change the badge of the app in the launcher.
It supports iOS, macOS, and some Android devices (the official API does not support the feature, even on Oreo).


Android badge


Android badge

## 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 /ios/Runner/Info.plist:
```xml
UIBackgroundModes

remote-notification

```

## macOS

On macOS, 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 /macos/Runner/Info.plist:
```xml
NSUserNotificationAlertStyle
banner
```

### 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](https://github.com/leolin310148/ShortcutBadger/), ~ 16 launchers are supported.

### Dart

First, you just have to import the package in your dart files with:
```dart
import 'package:flutter_app_badger/flutter_app_badger.dart';
```

Then you can add a badge:
```dart
FlutterAppBadger.updateBadgeCount(1);
```

Remove a badge:
```dart
FlutterAppBadger.removeBadge();
```

Or just check if the device supports this feature with:
```dart
FlutterAppBadger.isAppBadgeSupported();
```