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),
},
fields: switch (json['fields']) {
null => {},
Map<String, Object?> $1 => {
for (final e in $1.entries)
decodeString(e.key): Value.fromJson(e.value),
},
_ => throw const FormatException('"fields" is not an object'),
},
createTime: switch (json['createTime']) {
null => null,
Object $1 => Timestamp.fromJson($1),
},
updateTime: switch (json['updateTime']) {
null => null,
Object $1 => Timestamp.fromJson($1),
},
);
}