getFileData static method
Gets the file metadata that is to be consumed by the api
This involves:
- The image base64 data, a String
- The content type; whether
PNG
orJPG
- The file name
- The title of the file
- The language; defaults to English(en)
Implementation
static Map<String, dynamic> getFileData(
{required File file, required String fileTitle}) {
return <String, dynamic>{
'base64data': base64Encode(file.readAsBytesSync()),
'contentType': file.path.split('/').last.split('.').last.toUpperCase(),
'filename': file.path.split('/').last,
'title': fileTitle,
'language': 'en',
};
}