fix asyncs
This commit is contained in:
parent
449640699f
commit
0e33113516
|
@ -79,7 +79,9 @@ Future<void> _postOnMastodon(reqJson) async {
|
|||
final photos =
|
||||
attachments.where((attachment) => attachment['type'] == 'photo');
|
||||
|
||||
final photoUrls = photos.map((photo) async {
|
||||
List<String> photoUrls = [];
|
||||
|
||||
for (final photo in photos) {
|
||||
final photoUrl = photo['photo']['sizes'].last['url'];
|
||||
// Generate a random filename.
|
||||
// Add the extension '.jpg'.
|
||||
|
@ -87,8 +89,8 @@ Future<void> _postOnMastodon(reqJson) async {
|
|||
final photoPath =
|
||||
'${Directory.systemTemp.path}/$photoFilename';
|
||||
await dio.download(photoUrl, photoPath);
|
||||
return photoPath;
|
||||
});
|
||||
photoUrls.add(photoPath);
|
||||
}
|
||||
|
||||
// Post the post on Mastodon.
|
||||
// First we upload all photos with dio.
|
||||
|
|
Loading…
Reference in a new issue