CancelableOperation.isCompleted returns true immediately after constructing the operation even if the future it was constructed with hasn't resolved. This was unexpected to me, and I assume this is not the intended behavior. Below is a little unit test that demonstrates the problem. The expectation on the final line of the test fails, though I would expect it to succeed.
import 'dart:async';
import 'package:async/async.dart';
import 'package:test/test.dart';
void main() {
group('CancelableOperation', () {
test('isComplete should be false before completed', () {
var completer = Completer<void>();
var operation = CancelableOperation.fromFuture(completer.future);
expect(operation.isCompleted, isFalse);
});
});
}