Skip to content

Conversation

a14n
Copy link
Contributor

@a14n a14n commented Jul 15, 2020

Description

NNBD migration for scheduler

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
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.

@fluttergithubbot fluttergithubbot added the framework flutter/packages/flutter repository. See also f: labels. label Jul 15, 2020
@a14n a14n requested a review from goderbauer July 15, 2020 20:36
Comment on lines 73 to 74
late StackTrace debugStack;
late Completer<T> completer;
Copy link
Member

Choose a reason for hiding this comment

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

Could these two be late final?

Copy link
Member

Choose a reason for hiding this comment

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

Actually, it looks like completer could just be final and initialized right here instead of in the constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed!

@@ -340,8 +338,8 @@ mixin SchedulerBinding on BindingBase {
///
/// The preferred way to watch for changes to this value is using
/// [WidgetsBindingObserver.didChangeAppLifecycleState].
AppLifecycleState get lifecycleState => _lifecycleState;
AppLifecycleState _lifecycleState;
AppLifecycleState? get lifecycleState => _lifecycleState;
Copy link
Member

Choose a reason for hiding this comment

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

I would expect this one to always return a non-null value. At the time when you can read it, _lifecycleState has always been initialized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing this line to:

AppLifecycleState get lifecycleState => _lifecycleState!;

causes a lot of failures in tests. For instance:

Null check operator used on a null value
  package:flutter/src/scheduler/binding.dart 340:58   SchedulerBinding.lifecycleState
  package:flutter/src/services/binding.dart 180:9     ServicesBinding.readInitialLifecycleStateFromNativeWindow
  package:flutter/src/services/binding.dart 34:5      ServicesBinding.initInstances
  package:flutter/src/gestures/binding.dart 66:11     GestureBinding.initInstances
  package:flutter/src/semantics/binding.dart 24:11    SemanticsBinding.initInstances
  package:flutter/src/rendering/binding.dart 32:11    RendererBinding.initInstances
  package:flutter/src/painting/binding.dart 23:11     PaintingBinding.initInstances
  package:flutter/src/widgets/binding.dart 257:11     WidgetsBinding.initInstances
  package:flutter_test/src/binding.dart 302:11        TestWidgetsFlutterBinding.initInstances
  package:flutter_test/src/binding.dart 898:11        AutomatedTestWidgetsFlutterBinding.initInstances
  package:flutter/src/foundation/binding.dart 57:5    new BindingBase
  package:flutter_test/src/binding.dart               new _TestWidgetsFlutterBinding&BindingBase&SchedulerBinding
  package:flutter_test/src/binding.dart               new _TestWidgetsFlutterBinding&BindingBase&SchedulerBinding&ServicesBinding
  package:flutter_test/src/binding.dart               new _TestWidgetsFlutterBinding&BindingBase&SchedulerBinding&ServicesBinding&GestureBinding
  package:flutter_test/src/binding.dart               new _TestWidgetsFlutterBinding&BindingBase&SchedulerBinding&ServicesBinding&GestureBinding&SemanticsBinding
  package:flutter_test/src/binding.dart               new _TestWidgetsFlutterBinding&BindingBase&SchedulerBinding&ServicesBinding&GestureBinding&SemanticsBinding&RendererBinding
  package:flutter_test/src/binding.dart               new _TestWidgetsFlutterBinding&BindingBase&SchedulerBinding&ServicesBinding&GestureBinding&SemanticsBinding&RendererBinding&PaintingBinding
  package:flutter_test/src/binding.dart               new _TestWidgetsFlutterBinding&BindingBase&SchedulerBinding&ServicesBinding&GestureBinding&SemanticsBinding&RendererBinding&PaintingBinding&WidgetsBinding
  package:flutter_test/src/binding.dart               new TestWidgetsFlutterBinding
  package:flutter_test/src/binding.dart               new AutomatedTestWidgetsFlutterBinding
  package:flutter_test/src/_binding_io.dart 25:7      ensureInitialized
  package:flutter_test/src/binding.dart 298:100       TestWidgetsFlutterBinding.ensureInitialized
  package:flutter_test/src/widget_tester.dart 123:71  testWidgets
  material/tabbed_scrollview_warp_test.dart 79:3      main
  package:flutter_goldens/flutter_goldens.dart 43:17  main
  dart:async                                          _completeOnAsyncReturn
  package:flutter_goldens/flutter_goldens.dart        FlutterLocalFileComparator.fromDefaultComparator
  dart:async                                          _completeOnAsyncReturn
  package:flutter_goldens_client/skia_client.dart     SkiaGoldClient.getExpectations
  dart:async                                          _completeOnAsyncReturn
  package:flutter_goldens_client/skia_client.dart     SkiaGoldClient.getExpectations.<fn>

return _primaryCompleter.future.then<R>(onValue, onError: onError);
}

@override
Future<void> timeout(Duration timeLimit, { dynamic onTimeout() }) {
Future<void> timeout(Duration timeLimit, {FutureOr<void> onTimeout()?}) {
Copy link
Member

Choose a reason for hiding this comment

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

Since you changed it above: Change this one also to the new function syntax?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@a14n
Copy link
Contributor Author

a14n commented Jul 16, 2020

PTAL

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
Copy link
Contributor Author

a14n commented Jul 16, 2020

@goderbauer can I merge regarding this job failure :

Google testing failed. Please contact a Google developer to investigate.

@goderbauer
Copy link
Member

Let me ask internally what the plan for NNBD is there. I'll get back to you.

@goderbauer
Copy link
Member

Let's wait with merging this patch until the other NNBD patch has landed in google and this check is green.

@goderbauer
Copy link
Member

Google internally is now ready for NNBD flutter. I restarted the "google testing" check. If it passes, we're ready to submit this.

@fluttergithubbot fluttergithubbot merged commit 9e658bc into flutter:master Jul 21, 2020
@a14n a14n deleted the nndb-scheduler branch July 21, 2020 06:57
Pragya007 pushed a commit to Pragya007/flutter that referenced this pull request Aug 11, 2020
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 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.

4 participants