getFile<T> method

Future<FileFormField<T>?> getFile<T>(
  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<FileFormField<T>?> getFile<T>(String field) async {
  final data = await bodyAsFormData();
  final fieldData = data[field];
  if (fieldData is! FileFormField<T>) {
    return null;
  }
  return fieldData;
}