fetchData method
Call this method to get the form data as a Map<String, dynamic> if all the fields are valid.
The content of the map is based on the ids specified in the form fields widgets.
Before returning the data, the form will validate all the fields and if any of them is invalid, this method will return null.
Implementation
Map<String, dynamic>? fetchData() {
if (widget.resetData) _data.clear();
if (_formKey.currentState?.validate() ?? false) {
_formKey.currentState?.save();
return _data;
}
return null;
}