WriteRequest.fromJson constructor
WriteRequest.fromJson(
- Object? j
Implementation
factory WriteRequest.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return WriteRequest(
database: switch (json['database']) {
null => '',
Object $1 => decodeString($1),
},
streamId: switch (json['streamId']) {
null => '',
Object $1 => decodeString($1),
},
writes: switch (json['writes']) {
null => [],
List<Object?> $1 => [for (final i in $1) Write.fromJson(i)],
_ => throw const FormatException('"writes" is not a list'),
},
streamToken: switch (json['streamToken']) {
null => Uint8List(0),
Object $1 => decodeBytes($1),
},
labels: switch (json['labels']) {
null => {},
Map<String, Object?> $1 => {
for (final e in $1.entries)
decodeString(e.key): decodeString(e.value),
},
_ => throw const FormatException('"labels" is not an object'),
},
);
}