GetIt class

Very simple and easy to use service locator You register your object creation or an instance of an object with registerFactory, registerSingleton or registerLazySingleton And retrieve the desired object using get

Constructors

GetIt()

Properties

allowReassignment ↔ bool
By default it's not allowed to register a type a second time. If you really need to you can disable the asserts by settingallowReassignment= true
read / write
hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

call<T>() → dynamic
get<T>() → T
retrives or creates an instance of a registered type T depending on the registration function used for this type.
registerFactory<T>(FactoryFunc<T> func) → void
registers a type so that a new instance will be created on each call of get on that type T type to register fun factory funtion for this type
registerLazySingleton<T>(FactoryFunc<T> func) → void
registers a type as Singleton by passing a factory function that will be called on the first call of get on that type T type to register fun factory funtion for this type
registerSingleton<T>(T instance) → void
registers a type as Singleton by passing an instance that will be returned on each call of get on that type T type to register fun factory funtion for this type
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited