Skip to content

Commit

Permalink
Null-assert the value given to a Completer expecting a non-null value
Browse files Browse the repository at this point in the history
The code with out the null assertion is legal as per the type signature, but will throw a runtime exception if the nullable value is null. To make this exception more explicit, the value must be null-checked before completing the completer with the value.

The analyzer will soon enforce such checks. See dart-lang/sdk#53253.

This PR is behaviorally a no-op.

Fixes flutter/flutter#136775
  • Loading branch information
srawlins authored Dec 14, 2023
1 parent 0b0fab8 commit 8c0e4a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/web_ui/test/engine/clipboard_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Future<void> testMain() async {
const MethodCodec codec = JSONMethodCodec();
final Completer<ByteData> completer = Completer<ByteData>();
void callback(ByteData? data) {
completer.complete(data);
completer.complete(data!);
}

clipboardMessageHandler.setDataMethodCall(
Expand Down

0 comments on commit 8c0e4a1

Please sign in to comment.