Sample.fromJson constructor
Implementation
factory Sample.fromJson(Map<String, dynamic> json) {
final deltasValue = json['deltas'];
return Sample(
id: _readInt(json['id'], fallback: 0),
kind: _readString(json['kind']),
label: _readString(json['label']),
type: _readString(json['type']),
owner: _readString(json['owner'], fallback: 'Global'),
scope: _readString(json['scope'], fallback: 'Global'),
updatedAt: _readInt(json['updatedAt'], fallback: 0),
note: _readString(json['note']),
status: _readOptionalString(json, 'status'),
value: _readOptionalString(json, 'value'),
listeners: _readOptionalInt(json, 'listeners'),
dependencies: _readOptionalInt(json, 'dependencies'),
writes: _readOptionalInt(json, 'writes'),
runs: _readOptionalInt(json, 'runs'),
lastDurationUs: _readOptionalInt(json, 'lastDurationUs'),
operation: _readOptionalString(json, 'operation'),
deltas: deltasValue == null
? null
: _readList(deltasValue, CollectionDelta.fromJson),
mutations: _readOptionalInt(json, 'mutations'),
);
}