loadLayout method

  1. @override
Future<PublishLayout> loadLayout(
  1. PublishSource source,
  2. String layoutId
)
override

Layout layoutId (a layout id the model lists).

Implementation

@override
Future<PublishLayout> loadLayout(PublishSource source, String layoutId) async {
  final t = await _target(source);
  final path = t.source.layoutPath(t.projectId, layoutId);
  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('Layout [$layoutId] does not exist ($path)');
  return decodeStoredPublishLayout(storedJson(data), layoutId: snapshot.id);
}