use<T extends Object?> method
Gets the instance of T
type with/without id
from the closest ancestor ReactterProvider.
final appController = context.use<AppController>();
final appControllerId = context.use<AppController>('uniqueId');
final appControllerNullable = context.use<AppController?>();
If T
is nullable and no matching instance is found,
use will return null
.
If T
is non-nullable and the instance 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 Object?>([String? id]) {
return ReactterProvider.contextOf<T>(this, id: id, listen: false);
}