data method

dynamic data({
  1. String? key,
  2. bool lowerCaseKeys = false,
})

Returns the data for the form If a key is provided, it will return the data for that key

Implementation

dynamic data({String? key, bool lowerCaseKeys = false}) {
  if (key != null && _data.containsKey(key)) {
    return _data[key];
  }

  if (lowerCaseKeys == true) {
    Map<String, dynamic> newData = {};
    for (var entry in _data.entries) {
      newData[entry.key.toLowerCase().replaceAll(" ", "_")] = entry.value;
    }
    return newData;
  }
  return _data;
}