flutter_badge_manager_foundation 0.0.2 copy "flutter_badge_manager_foundation: ^0.0.2" to clipboard
flutter_badge_manager_foundation: ^0.0.2 copied to clipboard

PlatformiOSmacOS

iOS and macOS implementation of the flutter_badge_manager plugin.

flutter_badge_manager_foundation #

The iOS and macOS implementation of flutter_badge_manager.

Usage #

This is the federated foundation (Darwin) implementation. You normally just depend on flutter_badge_manager and this package is pulled in automatically. You do not need to add it to pubspec.yaml unless you want to import it directly.

If you do import it explicitly, add to your pubspec.yaml:

dependencies:
  flutter_badge_manager_foundation: ^<latest>

Then:

import 'package:flutter_badge_manager/flutter_badge_manager.dart';

final supported = await FlutterBadgeManager.isSupported();
if (supported) {
  await FlutterBadgeManager.update(3);
  await FlutterBadgeManager.remove();
}

iOS #

Requires notification (badge) permission. Request it before updating the badge if you manage permissions manually.

Add (if you need remote notifications background refresh):

<!-- ios/Runner/Info.plist -->
<key>UIBackgroundModes</key>
<array>
  <string>remote-notification</string>
</array>

Minimum iOS version: 13.0.

macOS #

Requires user notification authorization for badge display.

Optional Info.plist key to ensure banner style:

<!-- macos/Runner/Info.plist -->
<key>NSUserNotificationAlertStyle</key>
<string>banner</string>

Minimum macOS version: 10.15.

API (via main plugin) #

  • FlutterBadgeManager.isSupported()
  • FlutterBadgeManager.update(int count) (count >= 0)
  • FlutterBadgeManager.remove()

Negative counts throw PlatformException(code: 'invalid_args').

Notes #

  • Badge changes are applied via UIApplication.shared.applicationIconBadgeNumber (iOS) and NSApplication.shared.dockTile.badgeLabel (macOS).
  • Permission prompts are not auto-triggered if you never requested notifications; make sure to request authorization when needed.

License #

BSD 3-Clause (see LICENSE).

0
likes
150
points
44
downloads

Publisher

unverified uploader

Weekly Downloads

iOS and macOS implementation of the flutter_badge_manager plugin.

Repository (GitHub)
View/report issues

Topics

#badge #manager

Documentation

API reference

Funding

Consider supporting this project:

www.buymeacoffee.com
www.patreon.com
boosty.to

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_badge_manager_platform_interface

More

Packages that depend on flutter_badge_manager_foundation

Packages that implement flutter_badge_manager_foundation