dartpub.dev DartNative · beta
plugins / dartnative_system
ds

dartnative_system

v1.0.0 dartpub Free

App info and badge count

The native app info and badge for DartNative — read your app's name, version, and build (`PackageInfo.fromPlatform`) and set the home-screen icon badge count (`AppBadgePlus.updateBadge`). One API on iOS and Android.

by DartNative/dartnative_system · DartNative ≥ 3.0 · updated 3 weeks ago
Install
Free
pubspec.yaml
dependencies:
  dartnative_system: ^1.0.0
Weekly installs
40
Active apps
8
Rating
0.0 · 0
Open issues
0

dartnative_system

App info and the home-screen badge for DartNative — read your app's name / version / build, and set the app-icon badge count. iOS and Android, one API.

Why you'll like it

  • App info in one call — name, package id, version, and build number.
  • App badge — set the icon badge (e.g. an unread count), clear it with 0.
  • Both platforms, no setup.

Highlights

  • PackageInfo.fromPlatform()appName, packageName, version, buildNumber.
  • AppBadgePlus.updateBadge(count) — set the app-icon badge (0 clears it).
  • AppBadgePlus.isSupported() — whether badging works on this device.

Install

dependencies:
  dartnative_system: ^1.0.0   # from dartpub.dev
dn pub get
void main() {
  DartNativePluginRegistrant.registerAll();
  runApp(const MyApp());
}

Quick look

import 'package:dartnative_system/dartnative_system.dart';

Read app info:

final info = await PackageInfo.fromPlatform();
print('${info.appName} ${info.version}+${info.buildNumber}');

Set (or clear) the app-icon badge:

if (await AppBadgePlus.isSupported()) {
  await AppBadgePlus.updateBadge(3); // show "3"
  await AppBadgePlus.updateBadge(0); // clear
}

The iOS badge shows only if the user has allowed badges (notification permission). Android badge support depends on the launcher.

Platform setup

iOS

No native setup required.

Android

No native setup required.

Credits & license

Adapted from package_info_plus (BSD-3-Clause) and app_badge_plus, reworked to FFI.

Commercial plugin distributed via dartpub.dev — file issues on the plugin's page.