From de1921405c93f864ba1a6f646f664b16fa060a28 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Tue, 12 Sep 2023 08:53:15 -0700 Subject: [PATCH] Avoid passing a nullable value to Completer.complete (#1015) 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(); });