toStateMap method
Used to serialize Page instance with state to map for persistence.
Saves the player's state of the Page.
Implementation
Map<String, dynamic> toStateMap() {
return {
'endType': endTypeToString(endType),
'next': next.map((n) => n.toMap()).toList(),
"nodes": nodes.map((n) => n.toMap()).toList(),
"currentIndex": currentIndex,
};
}