ImplicitNavigator<T> constructor

const ImplicitNavigator<T>({
  1. Key? key,
  2. bool maintainHistory = false,
  3. required T value,
  4. int? depth,
  5. List<ValueHistoryEntry<T>>? initialHistory,
  6. required AnimatedValueWidgetBuilder<T> builder,
  7. RouteTransitionsBuilder transitionsBuilder = defaultRouteTransitionsBuilder,
  8. Duration transitionDuration = _kDefaultTransitionDuration,
  9. required void onPop(
    1. T poppedValue,
    2. T valueAfterPop
    ),
  10. bool takeFocus = false,
  11. bool maintainState = true,
  12. bool opaque = true,
  13. int? popPriority,
})

Create an implicit navigator directly from a value.

Like many widgets in the Flutter framework, ImplicitNavigator expects that value will not be mutated after it has been passed in here. Directly modifying value will result in incorrect behaviors. Whenever you wish to modify the value, a new object should be provided.

Generally, ImplicitNavigator.fromValueNotifier or ImplicitNavigator.selectFromListenable are simpler and should be used over this constructor.

To ensue value is updated when a page is popped, update it in onPop:

  value: myValue,
  onPop: (poppedValue, valueAfterPop) {
    myValue = valueAfterPop;
  },

Implementation

const ImplicitNavigator({
  Key? key,
  this.maintainHistory = false,
  required this.value,
  this.depth,
  this.initialHistory,
  required this.builder,
  this.transitionsBuilder = defaultRouteTransitionsBuilder,
  this.transitionDuration = _kDefaultTransitionDuration,
  required this.onPop,
  this.takeFocus = false,
  this.maintainState = true,
  this.opaque = true,
  this.popPriority,
}) : super(key: key);