Skip to content

Conversation

@ditman
Copy link
Member

@ditman ditman commented Nov 5, 2020

Description

This PR migrates the flutter_web_plugins to 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:

$ flutter test --platform chrome

Building flutter tool...
Running "flutter pub get" in flutter_web_plugins...                395ms
Throwing away cached asset graph because the language version of some package(s) changed.
This would most commonly happen when updating dependencies or changing your min sdk constraint.

00:16 +20: All tests passed!                    

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.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.

@flutter-dashboard flutter-dashboard bot added c: contributor-productivity Team-specific productivity, code health, technical debt. work in progress; do not review labels Nov 5, 2020
@google-cla google-cla bot added the cla: yes label Nov 5, 2020
Copy link

@blasten blasten left a 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

@ditman

This comment has been minimized.

@jonahwilliams
Copy link
Contributor

e375651 was reverted, so we need to figure out what the error is before this can land

@jonahwilliams
Copy link
Contributor

doing another dependency roll today

Copy link
Contributor

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.

Copy link
Member Author

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

@jonahwilliams
Copy link
Contributor

Version updates have landed BTW

@ditman
Copy link
Member Author

ditman commented Nov 5, 2020

I think I addressed all of @yjbanov's comments above!

@jonahwilliams, thanks for updating the deps! I think this will still fail analysis, because it seems flutter_test is still not migrated (or it seemed so while I was testing this with the latest SDK constraints and without the analysis_options.yaml file) It seems this only is a warning, everything else seems to work as expected. I'll push the change to the pubspec.yaml right now!

@ditman

This comment has been minimized.

@jonahwilliams
Copy link
Contributor

flutter and flutter_test should be fully migrated to null safety

@ditman

This comment has been minimized.

Copy link
Contributor

@mdebbar mdebbar left a 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!

@ditman ditman marked this pull request as ready for review November 6, 2020 00:31
@jonahwilliams
Copy link
Contributor

You need to pull in the latest master

@ditman
Copy link
Member Author

ditman commented Nov 6, 2020

Rebased all the way to a3f6ea6.

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ditman ditman changed the title flutter_web_plugins to null safety. Migrate flutter_web_plugins to null safety. Nov 6, 2020
@ditman ditman changed the title Migrate flutter_web_plugins to null safety. [flutter_web_plugins] Migrate to null safety. Nov 6, 2020
@fluttergithubbot fluttergithubbot merged commit e148bf8 into flutter:master Nov 6, 2020
@kevmoo
Copy link
Contributor

kevmoo commented Nov 9, 2020

Woo hoo!

When can we expect a dev release cut w/ this commit?

@ditman
Copy link
Member Author

ditman commented Nov 9, 2020

@kevmoo I'm not sure about the roll to dev, maybe "Flutter Rollers" knows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate flutter_web_plugins package to null safety

7 participants