abutil 1.2.2 copy "abutil: ^1.2.2" to clipboard
abutil: ^1.2.2 copied to clipboard

Common Flutter utilities for platform detection, app subtree restart, and update checks.

Abandoft Util #

Common Flutter utilities for platform detection, app subtree restart, and version update checks.

Platform #

abutil can be imported from Web and native targets directly.

import 'package:abutil/abutil.dart';

if (isDesktop()) {
  // Windows, macOS, or Linux.
}

Available helpers:

getPlatform()

isWeb()

isIOS()
isOHOS()
isAndroid()
isMobile()

isWindows()
isMacOS()
isLinux()
isDesktop()

Reboot #

Wrap the app subtree with Reboot, then call Reboot.begin(context) to rebuild that subtree with a new key.

runApp(
  const Reboot(
    child: MyApp(),
  ),
);
Reboot.begin(context);

Use Reboot.maybeBegin(context) when you prefer a bool result instead of an exception if the context is outside a Reboot subtree.

Update Checks #

hasUpdate(versionCode, latestVersion);

mustUpdate(
  latestUpdateTime,
  updateTime,
  interval: const Duration(days: 122),
);

mustUpdate compares updateTime with latestUpdateTime when it is available, or with the current time otherwise. It accepts DateTime, date strings, null, and empty values. Invalid updateTime values return false instead of throwing.

2
likes
150
points
3.13k
downloads

Documentation

API reference

Publisher

verified publisherabandoft.com

Weekly Downloads

Common Flutter utilities for platform detection, app subtree restart, and update checks.

Repository (GitHub)
View/report issues

Topics

#flutter #platform #utilities

License

MIT (license)

Dependencies

flutter

More

Packages that depend on abutil