pushNewScope abstract method

void pushNewScope({
  1. void init(
    1. GetIt getIt
    )?,
  2. String? scopeName,
  3. ScopeDisposeFunc? dispose,
  4. bool isFinal,
})

Creates a new registration scope. If you register types after creating a new scope they will hide any previous registration of the same type. Scopes allow you to manage different live times of your Objects. scopeName if you name a scope you can pop all scopes above the named one by using the name. dispose function that will be called when you pop this scope. The scope is still valid while it is executed init optional function to register Objects immediately after the new scope is pushed. This ensures that onScopeChanged will be called after their registration if isFinal is set to true, you can't register any new objects in this scope after this call. In Other words you have to register the objects for this scope inside init if you set isFinal to true. This is useful if you want to ensure that no new objects are registered in this scope by accident which could lead to race conditions

Implementation

void pushNewScope({
  void Function(GetIt getIt)? init,
  String? scopeName,
  ScopeDisposeFunc? dispose,
  bool isFinal,
});