4

Navigator.of(context).replace<T>(oldRoute: oldRoute, newRoute: newRoute);
How to using this origin Flutter Api in Getx?

I am using the named routes in project like this :

GetPage(
    name: Routes.SELECTTARGET,
    page: () => TargetPage(),
    binding: TargetBinding(),
    fullscreenDialog: true)

Another problem:
I am trying using
Navigator.of(Get.context!).push(GetPageRoute(settings: RouteSettings(name: Routes.TARGETDETAIL, arguments: target.clone())));
But error occus:

Null check operator used on a null value

How to do

zhouxinle
  • 429
  • 5
  • 16

1 Answers1

4

for navigating pages is like this:

Get.to(()=> Page()); // is same like to Navigator.push

Get.Off(()=> Page()); // is same like to Navigator.pushreplace something

for route Name : 

Get.toName(RouteName.name); or Get.OfftoNamed(RouteName.name);

for more info try to read the documentation

https://github.com/jonataslaw/getx/blob/master/documentation/en_US/route_management.md

Arbiter Chil
  • 1,061
  • 1
  • 6
  • 9