is there any way to cancel a dart Future?

You can use CancelableOperation or CancelableCompleter to cancel a future. See below the 2 versions: Solution 1: CancelableOperation (included in a test so you can try it yourself): cancel a future test(“CancelableOperation with future”, () async { var cancellableOperation = CancelableOperation.fromFuture( Future.value(‘future result’), onCancel: () => {debugPrint(‘onCancel’)}, ); // cancellableOperation.cancel(); // uncomment this to test … Read more