getItemWhere method

Future getItemWhere(
  1. bool where(
    1. dynamic
    ), {
  2. String? streamId,
})

Implementation

Future<dynamic> getItemWhere(
  bool Function(dynamic) where, {
  String? streamId,
}) async {
  final data = await get(streamId: streamId);
  if (data is Map) {
    return data.entries.firstWhere((entry) => where(entry.value));
  } else if (data is List) {
    return data.firstWhere(where);
  } else {
    throw StorageDatabaseException(
      "This Collection ($collectionId) does not support collections",
    );
  }
}