fromJson static method
A mutation as it arrived. The caller decides whether to trust it: a device names its own table and key, and nothing here checks either.
Implementation
static DVMutation fromJson(Map<String, Object?> json) {
final Object? base = json['base'];
return DVMutation(
mutationId: '${json['mutationId']}',
sequence: (json['sequence'] as num).toInt(),
table: '${json['table']}',
op: '${json['op']}',
key: json['key'] as Object,
values: (json['values'] as Map<Object?, Object?>? ??
const <Object?, Object?>{})
.map((Object? k, Object? v) => MapEntry<String, Object?>('$k', v)),
deviceTime: DateTime.parse('${json['deviceTime']}'),
correctedTime: DateTime.parse('${json['correctedTime']}'),
base: base is Map<Object?, Object?>
? DVRecord(
key: base['key'] as Object,
version: (base['version'] as num).toInt(),
values: (base['values'] as Map<Object?, Object?>? ??
const <Object?, Object?>{})
.map((Object? k, Object? v) =>
MapEntry<String, Object?>('$k', v)),
)
: null,
);
}