launch_mode 0.1.0 copy "launch_mode: ^0.1.0" to clipboard
launch_mode: ^0.1.0 copied to clipboard

Explicit, initialize-once launch modes for each Dart isolate, with simple foreground, background, and worker checks. Compatible with Flutter.

example/launch_mode_example.dart

// Console output is intentional in this runnable example.
// ignore_for_file: avoid_print

import 'package:launch_mode/launch_mode.dart';

void main() {
  LaunchMode.initialize(LaunchModeType.foreground);
  print('Launch mode: ${LaunchMode.current.name}');
  print('Initialized: ${LaunchMode.isInitialized}');

  if (LaunchMode.isForeground) {
    print('Run the main application startup logic.');
  } else if (LaunchMode.isBackground) {
    print('Run the background handler logic.');
  } else if (LaunchMode.isIsolate) {
    print('Run the computational worker logic.');
  }
}
0
likes
160
points
116
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Explicit, initialize-once launch modes for each Dart isolate, with simple foreground, background, and worker checks. Compatible with Flutter.

Repository (GitHub)
View/report issues

License

MIT (license)

More

Packages that depend on launch_mode