getTextFile method

Future<TextFileFormField> getTextFile (
  1. String field
)

Returns file for given field in form-data body. Returns null, if the field is not found, not a file field or body is not form-data.

Implementation

Future<TextFileFormField> getTextFile(String field) async {
  final data = await bodyAsFormData();
  if (data == null) return null;
  final fieldData = data[field];
  if (fieldData is! TextFileFormField) return null;
  return fieldData;
}