useDisposable<T extends Object> function

T useDisposable<T extends Object>(
  1. T create(),
  2. ValueCallback<T> dispose, [
  3. List<Object> keys = const []
])

Initially (and whenever keys change), create will be called to create an instance of T that will then always be returned late ron.

The created instance will be passed to dispose upon destruction of the hook.

Implementation

T useDisposable<T extends Object>(
  T Function() create,
  ValueCallback<T> dispose, [
  List<Object> keys = const [],
]) {
  return use(_DisposableHook(create, dispose, keys: keys));
}