From 38d938f49654ab1472b04137f3dfaf8ceff68e37 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Thu, 31 Aug 2023 15:34:47 -0700 Subject: [PATCH] Avoid passing a nullable value to Future.value or Completer.completer. 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! } ``` This change should be a no-op. Adding this explicit null-assert ensures that any exception is thrown right at the null-assert. --- dwds/lib/src/services/batched_expression_evaluator.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwds/lib/src/services/batched_expression_evaluator.dart b/dwds/lib/src/services/batched_expression_evaluator.dart index b50e1cdaf..b5e56c2af 100644 --- a/dwds/lib/src/services/batched_expression_evaluator.dart +++ b/dwds/lib/src/services/batched_expression_evaluator.dart @@ -156,7 +156,7 @@ class BatchedExpressionEvaluator extends ExpressionEvaluator { length: requests.length, ) .then((v) { - final result = v.first.value; + final result = v.first.value!; _logger.fine( 'Got result out of a batch for ${request.expression}: $result', );