fix sublist routine

This commit is contained in:
Inex Code 2022-04-21 07:25:42 +00:00
parent ea62890ba0
commit 9b67dca0e8

View file

@ -98,8 +98,8 @@ Future<void> _postOnMastodon(reqJson) async {
// If there are more than four photos, move other photos to another array to be posted in the thread. // If there are more than four photos, move other photos to another array to be posted in the thread.
List<String> otherPhotos = []; List<String> otherPhotos = [];
if (photoUrls.length > 4) { if (photoUrls.length > 4) {
otherPhotos = photos.skip(4).toList(); otherPhotos = photoUrls.sublist(4);
photoUrls = photos.take(4).toList(); photoUrls = photoUrls.sublist(0, 4);
} }
// Post the post on Mastodon. // Post the post on Mastodon.
@ -143,8 +143,8 @@ Future<void> _postOnMastodon(reqJson) async {
while (otherPhotos.isNotEmpty) { while (otherPhotos.isNotEmpty) {
mediaIds = []; mediaIds = [];
if (otherPhotos.length > 4) { if (otherPhotos.length > 4) {
otherPhotos = otherPhotos.skip(4).toList(); otherPhotos = photoUrls.sublist(4);
photoUrls = otherPhotos.take(4).toList(); photoUrls = photoUrls.sublist(0, 4);
} else { } else {
photoUrls = otherPhotos; photoUrls = otherPhotos;
otherPhotos = []; otherPhotos = [];