fresh method

Future<T?> fresh([
  1. List<String> withRelations = const []
])
inherited

Get a fresh instance of the model from the database.

Implementation

Future<T?> fresh([List<String> withRelations = const []]) async {
  if (!exists) return null;

  var q = query.where(primaryKey, '=', getKey());
  if (withRelations.isNotEmpty) {
    q = q.withRelations(withRelations);
  }

  return q.first();
}