async_signal 0.0.3 copy "async_signal: ^0.0.3" to clipboard
async_signal: ^0.0.3 copied to clipboard

Control the flow of asynchronous operations by signaling all the waiting tasks whether they should wait or continue at a specific point. Lock and unlock the flow.

example/lib/main.dart

import 'package:async_signal/async_signal.dart';

void main() async {
  final signal = AsyncSignal(locked: true);

  void getIn() async {
    await signal.wait();
    print('Finally, I\'m in!');
  }

  getIn();
  print('Wait, I will open the door after 3 seconds.');

  await Future.delayed(const Duration(seconds: 3));

  print('Opening the door...');
  signal.unlock();
}

// [Output]
// Wait, I will open the door after 3 seconds.

// 3 seconds later...

// [Output]
// Opening the door...
// Finally, I'm in!
2
likes
160
points
1.56k
downloads

Publisher

verified publisherdrafakiller.com

Weekly Downloads

Control the flow of asynchronous operations by signaling all the waiting tasks whether they should wait or continue at a specific point. Lock and unlock the flow.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on async_signal