db property

Returns the database executor, throwing an error if not set.

Implementation

DatabaseExecutor get db {
  if (_executor == null) {
    throw StateError('This model instance is not attached to a database executor. '
        'Relationships can only be loaded on models fetched via ModelQuery.');
  }
  return _executor!;
}