use<T extends Object?> method

T use<T extends Object?>([
  1. String? id
])

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);
}