subGetter method

Substitution<V> subGetter(
  1. ValueGetter<V> factory, {
  2. bool autoDispose = true,
})

Uses a callback (typically a constructor) to create a Substitution which can be passed into a GetScope.

This can be useful if, for example, a StatelessWidget builds a GetScope: passing a constructor tear-off like ListNotifier.new is preferred to ListNotifier(), since the latter would create a new Listenable object each time the widget is built.

Implementation

Substitution<V> subGetter(ValueGetter<V> factory, {bool autoDispose = true}) {
  return _SubFactory(_get.hooked, factory, autoDispose: autoDispose);
}