|
|
|
@ -17,15 +17,17 @@ class _ApiService implements ApiService {
|
|
|
|
|
String baseUrl; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Future<BaseData<UploadResult>> upload(data, folderId) async { |
|
|
|
|
Future<BaseData<UploadResult>> upload(data, folderId,bool isVideo) async { |
|
|
|
|
ArgumentError.checkNotNull(data, 'data'); |
|
|
|
|
ArgumentError.checkNotNull(folderId, 'folderId'); |
|
|
|
|
const _extra = <String, dynamic>{}; |
|
|
|
|
final queryParameters = <String, dynamic>{}; |
|
|
|
|
final _data = FormData(); |
|
|
|
|
String fileName = data.path.split(Platform.pathSeparator).last; |
|
|
|
|
if(!fileName.contains(".jpeg") && !fileName.contains(".mp4") && !fileName.contains(".png")) |
|
|
|
|
if(!isVideo && !fileName.contains(".jpeg") && !fileName.contains(".png")) |
|
|
|
|
fileName += ".jpeg"; |
|
|
|
|
else if(isVideo && !fileName.contains(".mp4")) |
|
|
|
|
fileName += ".mp4"; |
|
|
|
|
_data.files.add(MapEntry( |
|
|
|
|
'file', |
|
|
|
|
MultipartFile.fromFileSync(data.path, |
|
|
|
|