find<T extends RealmObject> method

T? find<T extends RealmObject>(
  1. Object? primaryKey
)

Fast lookup for a RealmObject with the specified primaryKey.

Implementation

T? find<T extends RealmObject>(Object? primaryKey) {
  final metadata = _metadata.getByType(T);

  final handle = _handle.find(metadata.classKey, primaryKey);
  if (handle == null) {
    return null;
  }

  final accessor = RealmCoreAccessor(metadata, _isInMigration);
  var object = RealmObjectInternal.create(T, this, handle, accessor);
  return object as T;
}