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