From cd341a291f8eba10d2da62543b30e72da69ec905 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Thu, 31 Aug 2023 15:45:13 -0700 Subject: [PATCH] Avoid passing a nullable value to Completer.complete 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 c, int? i) { Future.value(i); // Ouch! c.complete(i); // Ouch! } ``` --- pkgs/cupertino_http/lib/src/cupertino_api.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cupertino_http/lib/src/cupertino_api.dart b/pkgs/cupertino_http/lib/src/cupertino_api.dart index 414154c590..1f0a10369d 100644 --- a/pkgs/cupertino_http/lib/src/cupertino_api.dart +++ b/pkgs/cupertino_http/lib/src/cupertino_api.dart @@ -885,7 +885,7 @@ class URLSessionWebSocketTask extends URLSessionTask { if (error != null) { completer.completeError(error); } else { - completer.complete(message); + completer.complete(message!); } completionPort.close(); });