fix sublist routine

This commit is contained in:
Inex Code 2022-04-21 07:25:42 +00:00
parent ea62890ba0
commit 9b67dca0e8
1 changed files with 4 additions and 4 deletions

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.
List<String> otherPhotos = [];
if (photoUrls.length > 4) {
otherPhotos = photos.skip(4).toList();
photoUrls = photos.take(4).toList();
otherPhotos = photoUrls.sublist(4);
photoUrls = photoUrls.sublist(0, 4);
}
// Post the post on Mastodon.
@ -143,8 +143,8 @@ Future<void> _postOnMastodon(reqJson) async {
while (otherPhotos.isNotEmpty) {
mediaIds = [];
if (otherPhotos.length > 4) {
otherPhotos = otherPhotos.skip(4).toList();
photoUrls = otherPhotos.take(4).toList();
otherPhotos = photoUrls.sublist(4);
photoUrls = photoUrls.sublist(0, 4);
} else {
photoUrls = otherPhotos;
otherPhotos = [];