read method
Deserialise this field into the given entity
Implementation
@override
Future<dynamic> read(EntityEventSource src, value) {
if (value == null) {
return Future.value(null);
} else {
if (value is Map) {
return Future.wait(value.entries.map((pair) {
return src.ensureResolved(pair.value).then((resolved) {
return src.read(() => creator(resolved), resolved).then((read) {
if (read != null) onEntry(pair.key, read);
});
}).catchError((e) => throw e);
}));
} else {
throw UnsupportedError(
'Attempted to de-serialise map from non-map value for field $name',
);
}
}
}