我有一个简单的Flutter应用程序,我想删除所有以前的路线,但是我想使用GetX,该怎么做?
现在可以使用
Navigator.of(context).pushNamedAndRemoveUntil('/home', (Route<dynamic> route) => false);
但我想知道Get.to
或类似方法的正确方法,谢谢
最佳答案
您正在寻找Get.reset();
。请检查此page。
/// 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);
关于flutter - Get.to(MyPage())-如何删除所有先前的路线-Flutter GetX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64396103/