Page.fromJson constructor
Page.fromJson(
- Object? j
Implementation
factory Page.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return Page(
name: switch (json['name']) {
null => '',
Object $1 => decodeString($1),
},
content: switch (json['content']) {
null => '',
Object $1 => decodeString($1),
},
subpages: switch (json['subpages']) {
null => [],
List<Object?> $1 => [for (final i in $1) Page.fromJson(i)],
_ => throw const FormatException('"subpages" is not a list'),
},
);
}