【发布时间】:2020-12-29 22:46:47
【问题描述】:
我有一个运行良好的项目,但在最新的颤振核心更新后它没有,我得到:
E/flutter (4510): [错误:flutter/lib/ui/ui_dart_state.cc(166)] 未处理的异常:'package:flutter/src/widgets/navigator.dart': 断言失败:第 3582 行 pos 12: '_history.any(_RouteEntry.isPresentPredicate)': Navigator 没有 要替换的活动路线。 E/颤振(4510):#0
_AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39) E/flutter (4510): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
Future<void> _submit() async {
if (!_formKey.currentState.validate()) {
return;
}
_formKey.currentState.save();
final pref = await SharedPreferences.getInstance();
pref.setString('ip', _ip);
pref.setBool('isTablet', isTablet);
pref.setBool('setting1', isActivated);
// error on next part of the code
Navigator.of(context).pop();
Navigator.of(context).pushReplacementNamed('/');
Provider.of<Auth>(context, listen: false).logout();
}
谢谢
【问题讨论】: