【问题标题】:GetX - How replace an old route with a new route?GetX - 如何用新路线替换旧路线?
【发布时间】:2021-10-15 04:40:41
【问题描述】:

Navigator.of(context).replace<T>(oldRoute: oldRoute, newRoute: newRoute);
如何在 Getx 中使用这个源 Flutter Api?

我在这样的项目中使用命名路由:

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

另一个问题:
我正在尝试使用
Navigator.of(Get.context!).push(GetPageRoute(settings: RouteSettings(name: Routes.TARGETDETAIL, arguments: target.clone())));
但错误发生:

Null check operator used on a null value

怎么做

【问题讨论】:

    标签: flutter flutter-getx


    【解决方案1】:

    导航页面是这样的:

    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);
    

    欲了解更多信息,请尝试阅读文档

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

    【讨论】:

    • 出于某种原因我需要使用 orinal flutter api。怎么办?
    猜你喜欢
    • 1970-01-01
    • 2022-11-20
    • 1970-01-01
    • 2022-01-11
    • 2021-08-17
    • 1970-01-01
    • 2023-03-14
    • 2023-03-20
    • 1970-01-01
    相关资源
    最近更新 更多