Created
June 3, 2021 17:06
-
-
Save geeksilva97/ccc30d83951b1deb814177ac051bc247 to your computer and use it in GitHub Desktop.
Dio Upload Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:dio/dio.dart'; | |
class DioUploadService { | |
Future<dynamic> uploadPhotos(List<String> paths) async { | |
List<MultipartFile> files = []; | |
for(var path in paths) files.add(await MultipartFile.fromFile(path)); | |
var formData = FormData.fromMap({ | |
'files': files | |
}); | |
var response = await Dio().post('http://10.0.0.103:5000/profile/upload-mutiple', data: formData); | |
print('\n\n'); | |
print('RESPONSE WITH DIO'); | |
print(response.data); | |
print('\n\n'); | |
return response.data; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment