fix uploading files

This commit is contained in:
Inex Code 2022-04-21 06:57:41 +00:00
parent ef516ce396
commit 42fb1e5c0a

View file

@ -110,7 +110,7 @@ Future<void> _postOnMastodon(reqJson) async {
for (final photoUrl in photoUrls) {
final resp = await dio.post('$instanceUrl/api/v1/media',
data: dio_lib.FormData.fromMap({'file': File(photoUrl)}),
data: dio_lib.FormData.fromMap({'file': dio_lib.MultipartFile.fromFileSync(photoUrl)}),
options:
dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'}));
mediaIds.add(resp.data['id']);