ImplicitNavigator<T>.fromNotifier constructor

ImplicitNavigator<T>.fromNotifier({
  1. Key? key,
  2. required ValueNotifier<T> valueNotifier,
  3. int? getDepth(
    1. T value
    )?,
  4. List<ValueHistoryEntry<T>>? initialHistory,
  5. required AnimatedValueWidgetBuilder<T> builder,
  6. RouteTransitionsBuilder transitionsBuilder = defaultRouteTransitionsBuilder,
  7. Duration transitionDuration = const Duration(milliseconds: 300),
  8. void onPop(
    1. T poppedValue,
    2. T currentValue
    )?,
  9. bool takeFocus = false,
  10. bool maintainState = true,
  11. bool opaque = true,
  12. int? popPriority,
})

Creates an ImplicitNavigator that pushes new pages when the valueNotifier changes and reverts valueNotifier.value when pages are popped.

If non-null, getDepth we be called on each value and used to set ImplicitNavigator.depth. getDepth MUST return the same depth for a given value every time it's called on that value. If it returns inconsistent depths, ImplicitNavigator may push redundant pages and will not pop pages properly.

Implementation

ImplicitNavigator.fromNotifier({
  this.key,
  required ValueNotifier<T> valueNotifier,
  int? Function(T value)? getDepth,
  this.initialHistory,
  required this.builder,
  this.transitionsBuilder = defaultRouteTransitionsBuilder,
  this.transitionDuration = const Duration(milliseconds: 300),
  this.onPop,
  this.takeFocus = false,
  this.maintainState = true,
  this.opaque = true,
  this.popPriority,
})  : value = valueNotifier.value,
      depth = getDepth?.call(valueNotifier.value),
      _valueNotifier = valueNotifier,
      _getDepth = getDepth;