toReplace<T extends Object?, TO extends Object?> method
Replaces the current route with a new page.
Implementation
Future<T?> toReplace<T extends Object?, TO extends Object?>(Widget page) =>
Navigator.of(this)
.pushReplacement<T, TO>(MaterialPageRoute(builder: (_) => page));