Álv*_*ero 1 dart flutter flutter-routes getx
我有一个简单的 Flutter 应用程序,我想删除所有以前的路由,但我想使用 GetX,该怎么做?
现在它与
Navigator.of(context).pushNamedAndRemoveUntil('/home', (Route<dynamic> route) => false);
Run Code Online (Sandbox Code Playgroud)
但我想知道正确的方法Get.to或类似的
jon*_*ges 46
Get.offAll(Home());
Run Code Online (Sandbox Code Playgroud)
带有namedRoutes的:
Get.offAllNamed('/home');
Run Code Online (Sandbox Code Playgroud)
有关文档的更多信息: https://github.com/jonataslaw/getx/blob/master/documentation/en_US/route_management.md
小智 9
删除最后一页:
Get.off(()=>PageName());
Run Code Online (Sandbox Code Playgroud)
清除所有以前的页面:
Get.offAll(()=>PageName());
Run Code Online (Sandbox Code Playgroud)
如果您想删除最后一页,请使用它。
Get.off(Home());
Run Code Online (Sandbox Code Playgroud)
如果您想删除所有以前的页面,请使用它。
Get.offAll(Home());
Run Code Online (Sandbox Code Playgroud)
很简单
您正在寻找Get.reset();. 请检查此页面。
/// Clears all registered instances (and/or tags).
/// Even the persistent ones.
///
/// - [clearFactory] clears the callbacks registered by [Get.lazyPut()]
/// - [clearRouteBindings] clears Instances associated with Routes when using
/// [GetMaterialApp].
bool reset({bool clearFactory = true, bool clearRouteBindings = true}) =>
GetInstance().reset(
clearFactory: clearFactory, clearRouteBindings: clearRouteBindings);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6074 次 |
| 最近记录: |