shutdown 0.4.4 copy "shutdown: ^0.4.4" to clipboard
shutdown: ^0.4.4 copied to clipboard

Prioritized events for graceful shutdown in server Dart applications.

example/shutdown.dart

import 'dart:async';

import 'package:shutdown/shutdown.dart' as shutdown;

Future main() async {
  shutdown.triggerOnSigInt();
  shutdown.triggerOnSigHup();

  final db = await _acquireDB();
  shutdown.addHandler(() async => db.close());

  // [do you stuff]

  // call it at the end, this is a successful exit
  await shutdown.shutdown();
}

Future _acquireDB() async => null; // TODO: implement
8
likes
160
points
1.88k
downloads

Publisher

verified publisheragilord.com

Weekly Downloads

Prioritized events for graceful shutdown in server Dart applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on shutdown