hasCollectionId method

Future<bool> hasCollectionId(
  1. dynamic docId
)

Implementation

Future<bool> hasCollectionId(dynamic docId) async {
  final data = await get();
  if (_isMap(data)) {
    return Map.from(data).containsKey(docId);
  } else if (_isList(data)) {
    if (docId is! int) {
      throw const StorageDatabaseException("docId must be integer");
    }
    return List.from(data).length <= docId;
  } else {
    throw StorageDatabaseException(
      "This Collection ($collectionId) does not support collections",
    );
  }
}