currentScope property
int
currentScope
The index number of the current scope.
The number starts from 0.
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.
void main() {
print(Pot.currentScope); // 0
Pot.pushScope();
print(Pot.currentScope); // 1
Pot.popScope();
print(Pot.currentScope); // 0
}
Implementation
static int get currentScope => StaticPot.currentScope;