find<T extends Model> static method

Future<T?> find<T extends Model>({
  1. required String uuid,
})

Finds record by UUID.

Implementation

static Future<T?> find<T extends Model>({required String uuid}) async {
  final constructor = _jsonConstructors[T];
  if (constructor == null) return null;

  try {
    final models = await index<T>();
    return models.firstWhereOrNull((m) => m.uuid == uuid);
  } catch (e) {
    return null;
  }
}