fromMap static method
Used to deserialize from the map into Page instance.
If the state was present, it will be restored too.
Implementation
static Page fromMap(Map<String, dynamic>? map) {
if (map == null || map.isEmpty) {
return Page(
nodes: List.empty(growable: true), next: List.empty(growable: true));
}
List next = map['next'] as List;
List parsedNext = next.map<PageNext>((n) => PageNext.fromMap(n)).toList();
List nodes = map['nodes'] as List;
List parsedNodes = nodes.map<PageNode>((n) => PageNode.fromMap(n)).toList();
int? currentI = map['currentIndex'];
return Page(
next: parsedNext as List<PageNext>,
endType: endTypeFromString(map['endType']),
nodes: parsedNodes as List<PageNode>,
currentIndex: currentI == null ? 0 : currentI,
);
}