scope property

int? scope
inherited

The index number of the scope that the object of this pot has been bound to.

null is returned if there is no binding to a scope.

A "scope" here is a notion related to the lifespan of an object created by and held in a pot.

For example, if the index number of the current scope is 2 and the factory set in the constructor is triggered for the first time, an object is created by the factory and gets bound to the scope 2. The object exists while the current scope is 2 or newer, so it is discarded when the scope 2 is removed.

This getter is useful when you want to verify in tests that a pot is associated with a certain scope as expected.

Implementation

int? get scope => _scope;