-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[flutter_web_plugins] Migrate to null safety. #69844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flutter_web_plugins] Migrate to null safety. #69844
Conversation
blasten
left a comment
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 after @jonahwilliams comments are addressed
This comment has been minimized.
This comment has been minimized.
|
e375651 was reverted, so we need to figure out what the error is before this can land |
|
doing another dependency roll today |
packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart
Outdated
Show resolved
Hide resolved
packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart
Outdated
Show resolved
Hide resolved
packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart
Outdated
Show resolved
Hide resolved
packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart
Outdated
Show resolved
Hide resolved
packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart
Outdated
Show resolved
Hide resolved
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.
Is ?? '' the right fallback? In the previous version pathname continued to be null. This also ties into the previous question about whether pathname should ever be 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.
In this case, pathname comes from dart:html class AnchorElement, and it's defined as String?. In my tests it's never null, in fact, if no pathname is supplied, in chrome it returns '/'. According to the spec, it should return ''.
Looking at the next line of code (which I haven't touched), it seems that pathname will never be null, regardless of what the definition says. I'd say an empty string is a nice fallback.
(Just to double check, you can't call isEmpty on null)
Uncaught TypeError: Cannot read property 'get$isEmpty' of nullError: TypeError: Cannot read property 'get$isEmpty' of null
|
Version updates have landed BTW |
|
I think I addressed all of @yjbanov's comments above! @jonahwilliams, thanks for updating the deps! |
This comment has been minimized.
This comment has been minimized.
|
flutter and flutter_test should be fully migrated to null safety |
This comment has been minimized.
This comment has been minimized.
packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart
Outdated
Show resolved
Hide resolved
mdebbar
left a comment
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.
url strategy changes look good to me. Thanks for migrating!
packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart
Outdated
Show resolved
Hide resolved
|
You need to pull in the latest master |
…ovide default values in BrowserPlatformLocation for those.
…ull safety enabled by default now.
…shState() or replaceState() method is used.
|
Rebased all the way to a3f6ea6. |
jonahwilliams
left a comment
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
|
Woo hoo! When can we expect a dev release cut w/ this commit? |
|
@kevmoo I'm not sure about the roll to dev, maybe "Flutter Rollers" knows? |
Description
This PR migrates the
flutter_web_pluginsto null safety, and solves issues reported by the analyzer.The functionality stays the same. Null behavior should also stay the same as before; new implementation should be fully backwards-compatible.
Related Issues
Tests
Tests are also updated, and they all pass:
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 --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.