cancelable_compute 1.0.1 copy "cancelable_compute: ^1.0.1" to clipboard
cancelable_compute: ^1.0.1 copied to clipboard

outdated

Allows you to cancel compute operation.

example/example.dart

import 'package:cancelable_compute/cancelable_compute.dart';

Future<void> main() async {
  final operation = compute(fib, 256);
  Future<void>.delayed(Duration(seconds: 1), operation.cancel);
  final result = await operation.value;
  print(result ?? -1);
}

int fib(int n) {
  if (n < 2) {
    return n;
  }

  return fib(n - 2) + fib(n - 1);
}
4
likes
0
pub points
73%
popularity

Publisher

unverified uploader

Allows you to cancel compute operation.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on cancelable_compute