There's function to select the chapters based on index
selectInitialChapters(index:1){
// code to select the chapter details based on index
// chapter is a map
final keys = chapters.keys.toList();
final key = keys[index]; // the passed index may not exist
final lesson = chapters[key];
}
The information on the map will be updated based on the topic. Some subjects might not have any chapters with them or might not have more than one chapter (if the English chapter will be updated with the English chapter, if the GK chapter with the GK chapter). How can I find out if the passed index is present in the List?