devtools
c2e0343c - Stop passing a nullable value to Future<nn-type>.value or Completer<nn-type>.completer (#6228)

Commit
2 years ago
Stop passing a nullable value to Future<nn-type>.value or Completer<nn-type>.completer (#6228) * Stop passing a nullable value to Future<nn-type>.value or Completer<nn-type>.completer. This is cleanup work required to start enforcing this with static analysis, as per https://github.com/dart-lang/sdk/issues/53253. Real quick this issue is that this code is unsafe: ```dart void f(Completer<int> c, int? i) { Future<int>.value(i); // Ouch! c.complete(i); // Ouch! } ``` The typical fix is to add a null-assert (`!`), but sometimes a more appropriate or safer fix can be made. * Use non-nullable CpuSamples
Author
Parents
Loading