pushReplacement<T extends Object, TO extends Object> method

  1. @override
Future<T?> pushReplacement<T extends Object, TO extends Object>(
  1. Route<T> newRoute, {
  2. TO? result,
})
override

Replace the current route of the navigator that most tightly encloses the given context by pushing the given route and then disposing the previous route once the new route has finished animating in.

Modular.to.pushReplacement(
  MaterialPageRoute(builder: (context) => HomePage())
);

Implementation

@override
Future<T?> pushReplacement<T extends Object, TO extends Object>(
        Route<T> newRoute,
        {TO? result}) =>
    navigator.pushReplacement(newRoute, result: result);