Sitelet https://github.com/flutter/flutter/pull/192149
Skip to content

[material] Use super parameters in more places - #192149

Merged
srawlins merged 1 commit into
flutter:masterfrom
srawlins:super-p-mat
Sep 9, 2026
Merged

srawlins merged 1 commit into
flutter:masterfrom
srawlins:super-p-mat

Conversation

@srawlins

@srawlins srawlins commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

This is work towards dart-lang/sdk#59226

The lint rule use_super_parameters has a bug such that it didn't previously report these cases. But they will be reported soon.

Changes landed "upstream" at flutter/packages#12460

Pre-launch Checklist

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

This pull request contains changes to Material or Cupertino, which are currently frozen in this repository.

Changes should be made in material_ui and/or cupertino_ui in the flutter/packages repository.

Please refer to #188444 for instructions.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Sep 2, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors several constructors across the Flutter Material library and tests to utilize Dart's super-initializer parameters. The review feedback suggests omitting the redundant default value for super.autovalidateMode in DropdownMenuFormField to avoid duplicating state, and explicitly typing super.key as LocalKey in _TestPage to maintain type safety.

super.restorationId,
super.onSaved,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
super.autovalidateMode = AutovalidateMode.disabled,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Since FormField already defines AutovalidateMode.disabled as the default value for autovalidateMode, you can omit the default value here. In Dart, super parameters automatically inherit the default value from the super constructor if none is specified. This avoids duplicating the default value and keeps a single source of truth, adhering to the repository style guide.

    super.autovalidateMode,
References
  1. Avoid duplicating state: Keep only one source of truth. (link)


class _TestPage extends Page<dynamic> {
_TestPage({required this.builder, required LocalKey key}) : _key = GlobalKey(), super(key: key);
_TestPage({required this.builder, required super.key}) : _key = GlobalKey();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

By using super.key without an explicit type, the parameter's type is inferred from the super constructor (Page.key), which is LocalKey? (nullable). Since this parameter is marked required, it is better to keep it strictly non-nullable as LocalKey to maintain type safety and match the original signature. You can explicitly specify the type on the super parameter.

Suggested change
_TestPage({required this.builder, required super.key}) : _key = GlobalKey();
_TestPage({required this.builder, required LocalKey super.key}) : _key = GlobalKey();

@dkwingsmt dkwingsmt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

This is work towards dart-lang/sdk#59226

The lint rule use_super_parameters has a bug such that it didn't previously report these cases. But they will be reported soon.

Changes landed "upstream" at flutter/packages#12460
@dkwingsmt dkwingsmt added override code freeze Override an active code freeze. autosubmit Merge PR when tree becomes green via auto submit App labels Sep 9, 2026
@srawlins
srawlins added this pull request to the merge queue Sep 9, 2026
Merged via the queue into flutter:master with commit a388814 Sep 9, 2026
27 of 28 checks passed
@srawlins
srawlins deleted the super-p-mat branch September 9, 2026 04:47
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 9, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Sep 9, 2026
flutter/flutter@b444e78...63b9518

2026-09-09 engine-flutter-autoroll@skia.org Roll Packages from 9af9c60 to 36e088a (24 revisions) (flutter/flutter#192485)
2026-09-09 mdebbar@google.com Re-add Xcode and OpenJDK dependencies to macOS wasm local_engine builders (flutter/flutter#192238)
2026-09-09 30870216+gaaclarke@users.noreply.github.com Roll Dart SDK from 77094991d1c1 to 4be1b711b4ba (5 revisions) (flutter/flutter#192453)
2026-09-09 srawlins@google.com [material] Use super parameters in more places (flutter/flutter#192149)
2026-09-09 srawlins@google.com [cupertino] Use super parameters in more places (flutter/flutter#192148)
2026-09-09 bkonyi@google.com [flutter_tools] Gracefully handle EROFS and write-protected file system errors (flutter/flutter#192431)
2026-09-09 bkonyi@google.com [tool] Migrate BuildIOSCommand and BuildIOSArchiveCommand to modular dependency injection (flutter/flutter#192250)
2026-09-09 116356835+AbdeMohlbi@users.noreply.github.com Replace more enum instances comparison to use `equality ==` instead of `identical` and update related tests (flutter/flutter#192229)
2026-09-09 1961493+harryterkelsen@users.noreply.github.com [web] Support local screenshot and golden testing in felt test (flutter/flutter#191318)
2026-09-09 bkonyi@google.com [tool] Migrate DaemonCommand and DebugAdapterCommand to modular dependency injection (flutter/flutter#190793)
2026-09-09 1961493+harryterkelsen@users.noreply.github.com [web] Support local golden testing in flutter test (flutter/flutter#191386)
2026-09-09 bkonyi@google.com [flutter_tools] Ignore widget previews outside lib/ during LSP code generation (flutter/flutter#192326)
2026-09-09 bkonyi@google.com [flutter_tools] Read package_config.json asynchronously in loadPackageConfigWithLogging (flutter/flutter#192443)
2026-09-08 1961493+harryterkelsen@users.noreply.github.com Add precacheTestImage to flutter_test and unskip web image tests (flutter/flutter#191435)
2026-09-08 chris@bracken.jp et: Fix compile_commands.json post-processing (flutter/flutter#192395)
2026-09-08 kevmoo@users.noreply.github.com Refactor createDebuggingOptions and option registrations to OptionDescriptor (flutter/flutter#192307)
2026-09-08 bkonyi@google.com [flutter_tools] Fix test separation between `VersionFreshnessValidator` and `FlutterVersion.checkFlutterVersionFreshness` (flutter/flutter#191593)
2026-09-08 bkonyi@google.com [tool] Migrate EmulatorsCommand to modular dependency injection (flutter/flutter#190769)
2026-09-08 bkonyi@google.com [tool] Migrate Desktop build subcommands and toolchain to modular dependency injection (flutter/flutter#190781)
2026-09-08 bkonyi@google.com [tool] Migrate Tooling and Analysis commands to modular dependency injection (flutter/flutter#190788)
2026-09-08 71131015+wratheus@users.noreply.github.com Skip KGP version validation for AGP built-in Kotlin (flutter/flutter#192206)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC boetger@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…r#12814)

flutter/flutter@b444e78...63b9518

2026-09-09 engine-flutter-autoroll@skia.org Roll Packages from 9af9c60 to 36e088a (24 revisions) (flutter/flutter#192485)
2026-09-09 mdebbar@google.com Re-add Xcode and OpenJDK dependencies to macOS wasm local_engine builders (flutter/flutter#192238)
2026-09-09 30870216+gaaclarke@users.noreply.github.com Roll Dart SDK from 77094991d1c1 to 4be1b711b4ba (5 revisions) (flutter/flutter#192453)
2026-09-09 srawlins@google.com [material] Use super parameters in more places (flutter/flutter#192149)
2026-09-09 srawlins@google.com [cupertino] Use super parameters in more places (flutter/flutter#192148)
2026-09-09 bkonyi@google.com [flutter_tools] Gracefully handle EROFS and write-protected file system errors (flutter/flutter#192431)
2026-09-09 bkonyi@google.com [tool] Migrate BuildIOSCommand and BuildIOSArchiveCommand to modular dependency injection (flutter/flutter#192250)
2026-09-09 116356835+AbdeMohlbi@users.noreply.github.com Replace more enum instances comparison to use `equality ==` instead of `identical` and update related tests (flutter/flutter#192229)
2026-09-09 1961493+harryterkelsen@users.noreply.github.com [web] Support local screenshot and golden testing in felt test (flutter/flutter#191318)
2026-09-09 bkonyi@google.com [tool] Migrate DaemonCommand and DebugAdapterCommand to modular dependency injection (flutter/flutter#190793)
2026-09-09 1961493+harryterkelsen@users.noreply.github.com [web] Support local golden testing in flutter test (flutter/flutter#191386)
2026-09-09 bkonyi@google.com [flutter_tools] Ignore widget previews outside lib/ during LSP code generation (flutter/flutter#192326)
2026-09-09 bkonyi@google.com [flutter_tools] Read package_config.json asynchronously in loadPackageConfigWithLogging (flutter/flutter#192443)
2026-09-08 1961493+harryterkelsen@users.noreply.github.com Add precacheTestImage to flutter_test and unskip web image tests (flutter/flutter#191435)
2026-09-08 chris@bracken.jp et: Fix compile_commands.json post-processing (flutter/flutter#192395)
2026-09-08 kevmoo@users.noreply.github.com Refactor createDebuggingOptions and option registrations to OptionDescriptor (flutter/flutter#192307)
2026-09-08 bkonyi@google.com [flutter_tools] Fix test separation between `VersionFreshnessValidator` and `FlutterVersion.checkFlutterVersionFreshness` (flutter/flutter#191593)
2026-09-08 bkonyi@google.com [tool] Migrate EmulatorsCommand to modular dependency injection (flutter/flutter#190769)
2026-09-08 bkonyi@google.com [tool] Migrate Desktop build subcommands and toolchain to modular dependency injection (flutter/flutter#190781)
2026-09-08 bkonyi@google.com [tool] Migrate Tooling and Analysis commands to modular dependency injection (flutter/flutter#190788)
2026-09-08 71131015+wratheus@users.noreply.github.com Skip KGP version validation for AGP built-in Kotlin (flutter/flutter#192206)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC boetger@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…r#12814)

flutter/flutter@b444e78...63b9518

2026-09-09 engine-flutter-autoroll@skia.org Roll Packages from 9af9c60 to 36e088a (24 revisions) (flutter/flutter#192485)
2026-09-09 mdebbar@google.com Re-add Xcode and OpenJDK dependencies to macOS wasm local_engine builders (flutter/flutter#192238)
2026-09-09 30870216+gaaclarke@users.noreply.github.com Roll Dart SDK from 77094991d1c1 to 4be1b711b4ba (5 revisions) (flutter/flutter#192453)
2026-09-09 srawlins@google.com [material] Use super parameters in more places (flutter/flutter#192149)
2026-09-09 srawlins@google.com [cupertino] Use super parameters in more places (flutter/flutter#192148)
2026-09-09 bkonyi@google.com [flutter_tools] Gracefully handle EROFS and write-protected file system errors (flutter/flutter#192431)
2026-09-09 bkonyi@google.com [tool] Migrate BuildIOSCommand and BuildIOSArchiveCommand to modular dependency injection (flutter/flutter#192250)
2026-09-09 116356835+AbdeMohlbi@users.noreply.github.com Replace more enum instances comparison to use `equality ==` instead of `identical` and update related tests (flutter/flutter#192229)
2026-09-09 1961493+harryterkelsen@users.noreply.github.com [web] Support local screenshot and golden testing in felt test (flutter/flutter#191318)
2026-09-09 bkonyi@google.com [tool] Migrate DaemonCommand and DebugAdapterCommand to modular dependency injection (flutter/flutter#190793)
2026-09-09 1961493+harryterkelsen@users.noreply.github.com [web] Support local golden testing in flutter test (flutter/flutter#191386)
2026-09-09 bkonyi@google.com [flutter_tools] Ignore widget previews outside lib/ during LSP code generation (flutter/flutter#192326)
2026-09-09 bkonyi@google.com [flutter_tools] Read package_config.json asynchronously in loadPackageConfigWithLogging (flutter/flutter#192443)
2026-09-08 1961493+harryterkelsen@users.noreply.github.com Add precacheTestImage to flutter_test and unskip web image tests (flutter/flutter#191435)
2026-09-08 chris@bracken.jp et: Fix compile_commands.json post-processing (flutter/flutter#192395)
2026-09-08 kevmoo@users.noreply.github.com Refactor createDebuggingOptions and option registrations to OptionDescriptor (flutter/flutter#192307)
2026-09-08 bkonyi@google.com [flutter_tools] Fix test separation between `VersionFreshnessValidator` and `FlutterVersion.checkFlutterVersionFreshness` (flutter/flutter#191593)
2026-09-08 bkonyi@google.com [tool] Migrate EmulatorsCommand to modular dependency injection (flutter/flutter#190769)
2026-09-08 bkonyi@google.com [tool] Migrate Desktop build subcommands and toolchain to modular dependency injection (flutter/flutter#190781)
2026-09-08 bkonyi@google.com [tool] Migrate Tooling and Analysis commands to modular dependency injection (flutter/flutter#190788)
2026-09-08 71131015+wratheus@users.noreply.github.com Skip KGP version validation for AGP built-in Kotlin (flutter/flutter#192206)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC boetger@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD framework flutter/packages/flutter repository. See also f: labels. override code freeze Override an active code freeze. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants