Skip to content

Commit

Permalink
Avoid passing a nullable value to Future<nn-type>.value
Browse files Browse the repository at this point in the history
This is cleanup work required to start enforcing this with static analysis, as per dart-lang/sdk#53253.

Real quick this issue is that this code is unsafe:

```dart
void f(Completer<int> c, int? i) {
  Future<int>.value(i); // Ouch!
  c.complete(i);        // Ouch!
}
```
  • Loading branch information
srawlins authored Aug 31, 2023
1 parent d47a527 commit 5f14d4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion build_test/lib/src/written_asset_reader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class WrittenAssetReader extends MultiPackageAssetReader {
if (!source.assets.containsKey(id)) {
throw AssetNotFoundException(id);
}
return Future.value(source.assets[id]);
return Future.value(source.assets[id]!);
}

@override
Expand Down

0 comments on commit 5f14d4f

Please sign in to comment.