db property

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

Implementation

DatabaseExecutor get db {
  final executor = _executor;
  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;
}