newScope abstract method

ServiceContainer newScope()

Creates a child scope that inherits parent bindings but isolates singletons.

Useful for per-request or per-feature isolation.

final requestScope = container.newScope();
requestScope.bindInstance<Request>(currentRequest);

Implementation

ServiceContainer newScope();