Skip to content

Commit d796b01

Browse files
authored
Avoid passing a nullable value to potentially non-nullable parameters (flutter#137359)
Also ignore one case where it is hard to fix. 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. Fixes flutter#137294 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [Features we expect every widget to implement]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
1 parent 3bc64e8 commit d796b01

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

dev/benchmarks/macrobenchmarks/lib/src/web/recorder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ abstract class SceneBuilderRecorder extends Recorder {
287287
if (shouldContinue()) {
288288
PlatformDispatcher.instance.scheduleFrame();
289289
} else {
290-
profileCompleter.complete(_profile);
290+
profileCompleter.complete(_profile!);
291291
}
292292
} catch (error, stackTrace) {
293293
profileCompleter.completeError(error, stackTrace);

packages/flutter/lib/src/material/scaffold.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,6 +2351,10 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
23512351
if (animationController.status != AnimationStatus.dismissed) {
23522352
_dismissedBottomSheets.add(bottomSheet);
23532353
}
2354+
// TODO(srawlins): Ensure that this Completer has a nullable type (or more
2355+
// likely, `void`).
2356+
// https://github.com/flutter/flutter/issues/137294).
2357+
// ignore: null_argument_to_non_null_type
23542358
completer.complete();
23552359
}
23562360

0 commit comments

Comments
 (0)