get method

Future get({
  1. String? streamId,
})

Implementation

Future<dynamic> get({String? streamId}) async {
  if (!await exists) {
    throw StorageDatabaseException(
      "This collection ($collectionId) has not yet been created",
    );
    // await set({}, stream: false, keepData: false);
    // _cache = {};
  }

  dynamic collectionData = (parent != null
      ? (await parent!.get())[collectionId]
      : await storageDatabase.source.getData(collectionId));

  if (streamId != null && storageListeners.hasStreamId(path, streamId)) {
    storageListeners.getDate(path, streamId);
  }

  collectionData = await _encodeRefs(collectionData);
  _cache = collectionData;
  _cacheLoaded = true;

  return collectionData;
}