-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Conversation
@@ -36,7 +36,7 @@ class AndroidIntent { | |||
this.arguments, | |||
this.package, | |||
this.componentName, | |||
Platform platform, | |||
Platform? platform, | |||
this.type, | |||
}) : assert(action != null || componentName != null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you remind me why assert
is still needed in g3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This particular assert is useful because it checks that either action
or componentName
is non-null. Therefore, both are nullable.
For non-nullable vars, asserts are useful for mixed mode. If an app that is not yet migrated uses a null-safe library, they can still pass null to a non-nullable type. This will eventually fail with a _CastError if we remove the asserts. The assert is more explicit and meaningful. When most code in Dart ecosystem is migrated to null-safety and/or we have had a couple of stable releases of nnbd, we can start cleaning up the asserts. package:flutter is following the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* master: [android_intent] Migrate to nnbd (flutter#3328) [share] Migrate to null-safety (flutter#3311) [webview_flutter] Migrate to nnbd (flutter#3327) # Conflicts: # packages/webview_flutter/CHANGELOG.md # packages/webview_flutter/lib/platform_interface.dart # packages/webview_flutter/lib/webview_flutter.dart # packages/webview_flutter/pubspec.yaml # packages/webview_flutter/test/webview_flutter_test.dart
Description
Migrate android_intent plugin to nnbd.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?