这是indexloc提供的服务,不要输入任何密码
Skip to content

migrate animation to nullsafety #62485

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

Merged
merged 4 commits into from
Jul 29, 2020
Merged

migrate animation to nullsafety #62485

merged 4 commits into from
Jul 29, 2020

Conversation

a14n
Copy link
Contributor

@a14n a14n commented Jul 29, 2020

Description

NNBD migration for animation

Related Issues

Tests

I added the following tests:

None

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.

@fluttergithubbot fluttergithubbot added the framework flutter/packages/flutter repository. See also f: labels. label Jul 29, 2020
@fluttergithubbot
Copy link
Contributor

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@a14n a14n force-pushed the nnbd-animation branch from 79d227c to 8892155 Compare July 29, 2020 14:22
@a14n a14n requested a review from goderbauer July 29, 2020 14:54
@@ -414,22 +413,22 @@ class AnimationController extends Animation<double>
/// and the most recent tick of the animation.
///
/// If the controller is not animating, the last elapsed duration is null.
Duration get lastElapsedDuration => _lastElapsedDuration;
Duration _lastElapsedDuration;
Duration get lastElapsedDuration => _lastElapsedDuration!;
Copy link
Member

Choose a reason for hiding this comment

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

This is conflicting with the doc comment above it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@a14n a14n merged commit a7e868d into flutter:master Jul 29, 2020
@a14n a14n deleted the nnbd-animation branch July 29, 2020 20:00
@datayeah
Copy link

datayeah commented Jul 30, 2020

I now get "The named parameter 'vsync' isn't defined." when trying to use an AnimationController.
AnimationController( duration: const Duration(milliseconds: 800),vsync: this)

Do i have to change my code or is this broken now?

@a14n
Copy link
Contributor Author

a14n commented Jul 30, 2020

vsync param is still here https://github.com/flutter/flutter/pull/62485/files#diff-82a88b0b4aa73ca8c85c9fc068be95b6R242 .
This issue may be an issue regarding null-safety handling in your project. Is there a public repo reproducing the issue?

@LasseRosenow
Copy link
Contributor

Its probably because the analyzer does not understand the "required" keyword? which was @required before?

@datayeah
Copy link

@a14n My IDE (Android Studio 4.0.1) tells me that vsync does not exist and marks this as an error. It suggests adding the vsync parameter with label "TickerProvider:" instead of "vsync:". Fun fact: It compiles when using "vsync:", and it fails to compile if i use the suggested "TickerProvider:" label. I ran "flutter clean" but it doesnt change. I will try to investigate further...

@datayeah
Copy link

Its probably because the analyzer does not understand the "required" keyword? which was @required before?

yes, if i temporarily change it back to "@required" in the flutter sources, the vsync param is "detected" by the IDE, but then it crashes due to other changes that were made.

@a14n
Copy link
Contributor Author

a14n commented Jul 30, 2020

Can you try to run flutter analyze directly?

@datayeah
Copy link

No issues found! (ran in 12.7s;)

@a14n
Copy link
Contributor Author

a14n commented Jul 30, 2020

So it looks like your IDE uses a version of Dart that is not the one packaged with Flutter.

@datayeah
Copy link

datayeah commented Jul 30, 2020

Dart SDK version: 2.10.0-1.0.dev.flutter-24c7666def (be) (Wed Jul 22 13:22:07 2020 +0000) on "macos_x64"
I will try to sort this out, seems like it's more an IDE issue than a flutter issue. Thanks for the fast reply! (and for contributing to the framework:)

@datayeah
Copy link

Okay, to complete this and (maybe) help others:
The issue disappeared after restarting the IDE.
Note to self: Restart the IDE after "flutter upgrade".

@thisisgit
Copy link

@a14n Came from #62574 and just wondering the difference between required vs. @required?
Is it something that we all need to be prepared for the future release?

@a14n
Copy link
Contributor Author

a14n commented Aug 10, 2020

required has the same meaning in nullsafety as @required before nullsafety. See https://dart.dev/null-safety/understanding-null-safety#required-named-parameters

Is it something that we all need to be prepared for the future release?

As nullsafety is available behind an experimental flag I would not recommand to migrate your code for now.

Pragya007 pushed a commit to Pragya007/flutter that referenced this pull request Aug 11, 2020
* migrate animation to nullsafety

* nullable tween

* fix generic type issue

* address review comment
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
* migrate animation to nullsafety

* nullable tween

* fix generic type issue

* address review comment
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants