From 8c0e4a1f3d5fd525b4baeb61f4bc2b5bfd60be83 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Thu, 14 Dec 2023 14:14:48 -0800 Subject: [PATCH] Null-assert the value given to a Completer expecting a non-null value 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 https://github.com/flutter/flutter/issues/136775 --- lib/web_ui/test/engine/clipboard_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web_ui/test/engine/clipboard_test.dart b/lib/web_ui/test/engine/clipboard_test.dart index 097cf855d1eda..bad7902156ca6 100644 --- a/lib/web_ui/test/engine/clipboard_test.dart +++ b/lib/web_ui/test/engine/clipboard_test.dart @@ -58,7 +58,7 @@ Future testMain() async { const MethodCodec codec = JSONMethodCodec(); final Completer completer = Completer(); void callback(ByteData? data) { - completer.complete(data); + completer.complete(data!); } clipboardMessageHandler.setDataMethodCall(