processDocument method Null safety

Future<Map<String, dynamic>> processDocument(
  1. String fileName,
  2. String fileData,
  3. {List<String>? categories,
  4. bool deleteAfterProcessing = false,
  5. Map<String, dynamic>? params}
)

Process document from url.

Returns a Map containing the processed document information from the fileData using the desired or default options.

Implementation

Future<Map<String, dynamic>> processDocument(String fileName, String fileData,
    {List<String>? categories,
    bool deleteAfterProcessing = false,
    Map<String, dynamic>? params}) {
  final Map<String, dynamic> body = params ?? {};
  body['categories'] = categories ?? [];
  body['auto_delete'] = deleteAfterProcessing;
  body['file_data'] = fileData;
  body['file_name'] = fileName;

  return request(HTTPMethod.post, 'documents', body: body);
}