loadImage method
Implementation
int loadImage(String storageKey, int listLength) {
int storedIndex = Requests.box.read(storageKey) ?? 0;
int currentIndex = storedIndex;
if (storedIndex >= listLength - 1) {
storedIndex = 0;
} else {
storedIndex += 1;
}
Requests.box.write(storageKey, storedIndex);
return currentIndex;
}