use<T extends ReactterContext?> method
Gets the ReactterContext's instance of T
with/without id
from the closest ancestor of ReactterProvider.
final appContext = context.use<AppContext>();
final appContextId = context.use<AppContext>('uniqueId');
final appContextNullable = context.use<AppContext?>();
If T
is nullable and no matching ReactterContext is found, watch will
return null
.
If T
is non-nullable and the ReactterContext obtained returned null
, will
throw ProviderNullException
.
This method is equivalent to calling:
ReactterProvider.contextOf<T>(context, id: id, listen: false);
Implementation
T use<T extends ReactterContext?>([String? id]) =>
ReactterProvider.contextOf<T>(this, id: id, listen: false);