@@ -10,9 +10,6 @@ class FormBuilder extends StatefulWidget {
1010 /// will rebuild.
1111 final VoidCallback ? onChanged;
1212
13- /// DEPRECATED: Use [onPopInvokedWithResult] instead.
14- final void Function (bool )? onPopInvoked;
15-
1613 /// {@macro flutter.widgets.navigator.onPopInvokedWithResult}
1714 ///
1815 /// {@tool dartpad}
@@ -105,11 +102,6 @@ class FormBuilder extends StatefulWidget {
105102 required this .child,
106103 this .onChanged,
107104 this .autovalidateMode,
108- @Deprecated (
109- 'Use onPopInvokedWithResult instead. '
110- 'This feature was deprecated after v3.22.0-12.0.pre.' ,
111- )
112- this .onPopInvoked,
113105 this .onPopInvokedWithResult,
114106 this .initialValue = const < String , dynamic > {},
115107 this .skipDisabled = false ,
@@ -143,6 +135,7 @@ class FormBuilderState extends State<FormBuilder> {
143135 /// Only used to internal logic
144136 bool get focusOnInvalid => _focusOnInvalid;
145137
138+ /// Get if form is enabled
146139 bool get enabled => widget.enabled;
147140
148141 /// Verify if all fields on form are valid.
@@ -171,6 +164,7 @@ class FormBuilderState extends State<FormBuilder> {
171164 /// Get all fields of form.
172165 FormBuilderFields get fields => _fields;
173166
167+ /// Get all fields values of form.
174168 Map <String , dynamic > get instantValue => Map <String , dynamic >.unmodifiable (
175169 _instantValue.map (
176170 (key, value) => MapEntry (
@@ -204,15 +198,18 @@ class FormBuilderState extends State<FormBuilder> {
204198 initialValue[name];
205199 }
206200
201+ /// Get a field value by name
207202 void setInternalFieldValue <T >(String name, T ? value) {
208203 _instantValue[name] = value;
209204 widget.onChanged? .call ();
210205 }
211206
207+ /// Remove a field value by name
212208 void removeInternalFieldValue (String name) {
213209 _instantValue.remove (name);
214210 }
215211
212+ /// Register a field on form
216213 void registerField (String name, FormBuilderFieldState field) {
217214 // Each field must have a unique name. Ideally we could simply:
218215 // assert(!_fields.containsKey(name));
@@ -242,6 +239,7 @@ class FormBuilderState extends State<FormBuilder> {
242239 );
243240 }
244241
242+ /// Unregister a field on form
245243 void unregisterField (String name, FormBuilderFieldState field) {
246244 assert (
247245 _fields.containsKey (name),
@@ -270,23 +268,14 @@ class FormBuilderState extends State<FormBuilder> {
270268 }
271269 }
272270
271+ /// Save form values
273272 void save () {
274273 _formKey.currentState! .save ();
275274 // Copy values from instant to saved
276275 _savedValue.clear ();
277276 _savedValue.addAll (_instantValue);
278277 }
279278
280- @Deprecated (
281- 'Will be remove to avoid redundancy. Use fields[name]?.invalidate(errorText) instead' )
282- void invalidateField ({required String name, String ? errorText}) =>
283- fields[name]? .invalidate (errorText ?? '' );
284-
285- @Deprecated (
286- 'Will be remove to avoid redundancy. Use fields.first.invalidate(errorText) instead' )
287- void invalidateFirstField ({required String errorText}) =>
288- fields.values.first.invalidate (errorText);
289-
290279 /// Validate all fields of form
291280 ///
292281 /// Focus to first invalid field when has field invalid, if [focusOnInvalid] is `true` .
@@ -343,7 +332,7 @@ class FormBuilderState extends State<FormBuilder> {
343332 );
344333 }
345334
346- /// Reset form to `initialValue`
335+ /// Reset form to `initialValue` set on FormBuilder or on each field.
347336 void reset () {
348337 _formKey.currentState? .reset ();
349338 }
@@ -376,8 +365,6 @@ class FormBuilderState extends State<FormBuilder> {
376365 key: _formKey,
377366 autovalidateMode: widget.autovalidateMode,
378367 onPopInvokedWithResult: widget.onPopInvokedWithResult,
379- // ignore: deprecated_member_use
380- onPopInvoked: widget.onPopInvoked,
381368 canPop: widget.canPop,
382369 // `onChanged` is called during setInternalFieldValue else will be called early
383370 child: _FormBuilderScope (
0 commit comments