getContent method

Future<Content> getContent(
  1. String doc
)

Implementation

Future<Content> getContent(String doc) => FirestoreDatabase.instance
    .collection(collection)
    .doc(doc)
    .get()
    .then((d) async {
      Chunk c = $Chunk.fromMap(d.data ?? {});
      if (c.modality == .image) {
        return Content.imageBase64(
          base64Encode(
            await FireStorage.instance.bucket(bucket).ref(c.content).read(),
          ),
        );
      }

      return Content.text(c.fullContent);
    });