EventFractal.fromMap constructor
EventFractal.fromMap(
- MP d
Implementation
EventFractal.fromMap(MP d)
: pubkey = d['pubkey'] ?? '',
createdAt = d['created_at'] ?? unixSeconds,
content = '${d['content'] ?? ''}',
syncAt = d['sync_at'] ??
switch (d['to']) {
EventFractal ev => ev.decideSync,
_ => 1,
},
sig = d['sig'] ?? '',
owner = d['owner'],
super.fromMap(d) {
to = d['to'];
hash = d['hash'] ?? '';
if (d['shared_with'] case List shared) {
for (var x in shared) {
switch (x) {
case String h:
final device = EventFractal.storage[h] as DeviceFractal;
sharedWith.add(device);
case DeviceFractal device:
sharedWith.add(device);
}
}
}
/*
final nHash = makeHash();
if (hash != nHash) {
//throw throw Exception('hash $hash != $nHash of $type');
isValid = false;
}
*/
_construct();
constructFromMap(d).then((b) {
if (hash.isNotEmpty) {
complete();
}
});
}