loadComponent method
Component type (a type name the model's components lists): the
definition stored at PublishSource.componentPath. Throws a
PublishLoadException when there is none.
Implementation
@override
Future<PublishComponent> loadComponent(PublishSource source, String type) async {
final t = await _target(source);
final path = t.source.componentPath(t.projectId, type);
final DocumentSnapshot<Map<String, dynamic>> snapshot;
try {
snapshot = await firestore.doc(path).get();
} catch (e) {
throw PublishLoadException('Could not read $path', e);
}
final data = snapshot.data();
if (!snapshot.exists || data == null) throw PublishLoadException('Component [$type] does not exist ($path)');
return decodeStoredPublishComponent(storedJson(data), type: snapshot.id);
}