ensureExists method

  1. @protected
void ensureExists()

Subclasses of Aggregate should use this method to ensure that is is operating on an existing Aggregate.

Implementation

@protected
void ensureExists() {
  if (currentVersion == -1) {
    throw AggregateNotFoundException(runtimeType, id);
  }
}