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