findFirst method Null safety

Future<RecordSnapshot<K, V>?> findFirst(
  1. DatabaseClient databaseClient,
  2. {Finder? finder}
)

Find a single record.

Returns null if not found.

Implementation

Future<RecordSnapshot<K, V>?> findFirst(DatabaseClient databaseClient,
    {Finder? finder}) async {
  final client = getClient(databaseClient);

  var record = await client
      .getSembastStore(this)
      .txnFindRecord(client.sembastTransaction, finder);
  if (record == null) {
    return null;
  } else {
    return SembastRecordSnapshot<K, V>.fromRecord(record);
  }
}