getBinaryFile method

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