Skip to content

Remove the nullOk parameter from Navigator.of and add Navigator.maybeOf - #70726

Merged
gspencergoog merged 1 commit into
flutter:masterfrom
gspencergoog:remove_navigator_nullok
Nov 20, 2020
Merged

gspencergoog merged 1 commit into
flutter:masterfrom
gspencergoog:remove_navigator_nullok

Conversation

@gspencergoog

Copy link
Copy Markdown
Contributor

Description

Adds Navigator.maybeOf to replace calling Navigator.of(context, nullOk: true), and removes the nullOk parameter. Also changes Navigator.of to return a non-nullable value, and removes many (120!) instances of the ! operator, reducing the possible places where a null dereference could occur.

Related Issues

Tests

  • No tests were harmed in the making of this PR.
  • Added tests to make sure that of, maybeOf work as expected.

Breaking Change

  • Yes, this is a breaking change that will require a migration guide.

@flutter-dashboard flutter-dashboard Bot added p: cupertino_ui cupertino_ui package in flutter/packages p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Nov 17, 2020
@google-cla google-cla Bot added the cla: yes label Nov 17, 2020
@gspencergoog gspencergoog changed the title Remove the nullOk parameter from Navigator.of and add Navigator.maybeOf Remove the nullOk parameter from Navigator.of and add Navigator.maybeOf Nov 17, 2020
@gspencergoog
gspencergoog force-pushed the remove_navigator_nullok branch from dc34d3c to 6e089c2 Compare November 17, 2020 23:24
@gspencergoog
gspencergoog force-pushed the remove_navigator_nullok branch from 6e089c2 to 462d78e Compare November 18, 2020 00:58

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@gspencergoog
gspencergoog merged commit de884f1 into flutter:master Nov 20, 2020
@gspencergoog
gspencergoog deleted the remove_navigator_nullok branch November 20, 2020 17:10
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. framework flutter/packages/flutter repository. See also f: labels. p: cupertino_ui cupertino_ui package in flutter/packages p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants