getDocWhere method

DocRefMemory? getDocWhere(
  1. bool testMethod(
    1. dynamic element
    )
)

Implementation

DocRefMemory? getDocWhere(
  bool Function(dynamic element) testMethod,
) {
  String collId = _id;
  if (_memoryDb[collId] == null) return null;
  Map<String, dynamic>? doc = _memoryDb[collId]!.cast().firstWhere(
        testMethod,
        orElse: () => null,
      );
  if (doc == null) {
    return null;
  } else {
    String docId = doc[DBRKeys.id];
    return DocRefMemory(docId, _collRefMemory, _memoryDb);
  }
}