returns true if all registered async or dependent objects are ready
and call onReadyonError handlers when the all-ready state is reached
you can force a timeout Exceptions if allReady hasn't
return true within timeout
It will trigger a rebuild if this state changes
registers a handler that is called when the all-ready state is reached
it does not trigger a rebuild like allReady does
you can force a timeout Exceptions if allReady completed
within timeout which will call onError
Add additional properties associated with the node.
inherited
get<T extends Object>({String?instanceName, dynamicparam1, dynamicparam2})
→ T
all the following functions can be called inside the build function but also
in e.g. in initState of a StatefulWidget.
The mixin takes care that everything is correctly disposed.
retrieves or creates an instance of a registered type T depending on the registration
function used for this type or based on a name.
for factories you can pass up to 2 parameters param1,param2 they have to match the types
given at registration with registerFactoryParam()
returns true if the registered async or dependent object defined by T and
instanceName is ready
and call onReadyonError handlers when the ready state is reached
you can force a timeout Exceptions if isReady hasn't
return true within timeout
It will trigger a rebuild if this state changes
Pushes a new GetIt-Scope. After pushing it executes init where you can register
objects that should only exist as long as this scope exists.
Can be called inside the build method method of a StatelessWidget.
It ensures that it's only called once in the lifetime of a widget.
When the widget is destroyed the scope too gets destroyed after dispose
is executed. If you use this function and you have registered your objects with
an async disposal function, that functions won't be awaited.
I would recommend doing pushing and popping from your business layer but sometimes
this might come in handy
Will triger a rebuild of the Widget if any new GetIt-Scope is pushed or popped
This function will return true if the change was a push otherwise false
If no change has happend the return value will be null
registers a handler for a Future exactly once on the first build
and unregisters is when the widget is destroyed.
This handler will only called once when the Future completes.
select allows you to register the handler to a member of the of the Object
stored in GetIt. If the object itself if the Future pass (x)=>x here
If you pass initialValue your passed handler will be executes immediately
with that value.
All handler get passed in a cancel function that allows to kill the registration
from inside the handler.
/// if the Future has completed handler will be called every time until
the handler calls cancel or the widget is destroyed
registers a handler for a ValueListenable exactly once on the first build
and unregisters is when the widget is destroyed.
select allows you to register the handler to a member of the of the Object
stored in GetIt. If the object itself if the ValueListenable pass (x)=>x here
If you set executeImmediately to true the handler will be called immediately
with the current value of the ValueListenable.
All handler get passed in a cancel function that allows to kill the registration
from inside the handler.
registers a handler for a Stream exactly once on the first build
and unregisters is when the widget is destroyed.
select allows you to register the handler to a member of the of the Object
stored in GetIt. If the object itself if the Stream pass (x)=>x here
If you pass initialValue your passed handler will be executes immediately
with that value
All handler get passed in a cancel function that allows to kill the registration
from inside the handler.
To observe ValueListenables
like get but it also registers a listener to T and
triggers a rebuild every time T.value changes
If target is not null whatch will observe this Object instead of
looking inside GetIt
awaits the Future returned by select and triggers a rebuild as soon
as the Future completes. After that it returns
an AsyncSnapshot with the received data from the Future
When you call watchFuture a second time on the same Future it will
return the last received data but not observe the Future a another time.
To be able to use watchStream inside a build function
we have to pass initialValue so that it can return something before
the Future has completed
if select returns a different Future than on the last call, watchFuture
will ignore the completion of the previous Future and observe the completion
of the new Future.
preserveState determines then if the new initial value should be the last
value of the previous stream or again initialValue
like watch but for simple Listenable objects.
It only triggers a rebuild when the value that
only returns changes. With that you can react to changes of single members
of T
If only is null it will trigger a rebuild every time the Listenable changes
in this case R has to be equal to T
If target is not null whatch will observe this Object as Listenable instead of
looking inside GetIt
subscribes to the Stream returned by select and returns
an AsyncSnapshot with the latest received data from the Stream
Whenever new data is received it triggers a rebuild.
When you call watchStream a second time on the same Stream it will
return the last received data but not subscribe another time.
To be able to use watchStream inside a build function we have to pass
initialValue so that it can return something before it has received the first data
if select returns a different Stream than on the last call, watchStream
will cancel the previous subscription and subscribe to the new stream.
preserveState determines then if the new initial value should be the last
value of the previous stream or again initialValue
like watch but it only triggers a rebuild when the value of
the ValueListenable, that the function select returns changes
useful if the ValueListenable is a member of your business object T