Skip to content

Commit

Permalink
Avoid passing a nullable value to Completer<nn-type>.complete
Browse files Browse the repository at this point in the history
This is cleanup work required to start enforcing this with static analysis, as per dart-lang/sdk#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!
}
```
  • Loading branch information
srawlins authored Aug 31, 2023
1 parent 7fb6fd6 commit cd341a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkgs/cupertino_http/lib/src/cupertino_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ class URLSessionWebSocketTask extends URLSessionTask {
if (error != null) {
completer.completeError(error);
} else {
completer.complete(message);
completer.complete(message!);
}
completionPort.close();
});
Expand Down

0 comments on commit cd341a2

Please sign in to comment.