submitForm method

Map<String, String> submitForm()

Submits the values of all FormCraftTextField widgets.

Returns a map of field keys to their corresponding input values.

Implementation

Map<String, String> submitForm() {
  // Map to store the submitted values of each field
  final items = <String, String>{};

  // Iterate through each field and get its input value
  globalKeys.forEach((key, globalKey) {
    items.addAll(
      {key: globalKey.currentState?._getInputValue() ?? ''},
    );
  });

  // Return the map of field keys and their input values
  return items;
}