ServiceContainer class

Implementation of the service locator pattern.

Constructors

ServiceContainer({String? name, ServiceContainer? parent})

Properties

hashCode int
The hash code for this object.
no setterinherited
name String?
Name of the container (scope)
final
parent ServiceContainer?
Parent of the container
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add<T>(T factory(), {String? tag, bool lazy = false, bool singleton = true}) → void
Register a service
contains<T>({String? tag}) bool
Whether this container and its ancestors contain services
get<T>({String? tag}) → T
Lookup a service from this container and its ancestors
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove<T>({String? tag}) bool
Remove a service
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited