Repository navigation
exposing FormState _fields value #110760
Copy link
Copy link
Closed
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: duplicateIssue is closed as a duplicate of an existing issueIssue is closed as a duplicate of an existing issueteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Use case
the form widget can be a powerful tool as it caches and can interact with all its child FormField without having to manually track them through keys. this is useful for a couple build in features like submitting & saving. but blocks the user from creating it's own implementations like for example #107530
Proposal
make the FormState _fields value into a public field so we can use it to extend its functionality
/// State associated with a [Form] widget.
///
/// A [FormState] object can be used to [save], [reset], and [validate] every
/// [FormField] that is a descendant of the associated [Form].
///
/// Typically obtained via [Form.of].
class FormState extends State<Form> {
final Set<FormFieldState<dynamic>> fields = <FormFieldState<dynamic>>{};
...
}this issue would allow us to implement our own extensions that would, for example, make #107528 doable by the user.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: duplicateIssue is closed as a duplicate of an existing issueIssue is closed as a duplicate of an existing issueteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Activity
Mairramer commentedon Jan 9, 2026
@Piinks @justinmc I was looking at this and I have a concern. By exposing a getter for fields, we also end up exposing members like
restorePendingandbucket, which I don’t think should be part of the public API.I tried annotating the getter with
@protected, but that introduces warnings in other widgets and feels like a code smell to me. Is there a better way to expose this without leaking those internals, or is this not really a problem(maybe onlybucket)?Perhaps using
@internalwill solve this..justinmc commentedon Jan 16, 2026
Closing this as a duplicate of #107528. I plan to address @Mairramer's comment in #180815.
casvanluijtelaar commentedon Jan 19, 2026
@justinmc either you accidentally closed this, or listed the wrong duplicate?
danagbemava-nc commentedon Jan 20, 2026
@casvanluijtelaar, wrong duplicate. I fixed it
github-actions commentedon Feb 3, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.Add fields getter to FormState (#180815)
Add fields getter to FormState (flutter#180815)
Add fields getter to FormState (flutter#180815)
Add fields getter to FormState (#180815)