Browse Source

1.优化首页重启的问题

tags/0.0.8+2
“yanghuaxuan” 3 years ago
parent
commit
2b322173f0
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      lib/util/net_util.dart

+ 6
- 3
lib/util/net_util.dart View File

@@ -170,9 +170,12 @@ class NetUtil {
///非法用户 ///非法用户
if (result[GlobalConfig.HTTP_RESPONSE_KEY_CODE]?.toString() == '401000') { if (result[GlobalConfig.HTTP_RESPONSE_KEY_CODE]?.toString() == '401000') {
try { try {
Future.delayed(Duration(seconds: 0)).then((onValue) {
BuildContext context = navigatorKey.currentState.overlay.context;
Provider.of<UserInfoNotifier>(context, listen: false).unLogin();
Future.delayed(Duration(seconds: 0)).then((onValue) async {
String token= await SharedPreferencesUtil.getStringValue(GlobalConfig.SHARED_KEY_TOKEN);
if(token!=null&&token.length>2){
BuildContext context = navigatorKey.currentState.overlay.context;
Provider.of<UserInfoNotifier>(context, listen: false).unLogin();
}
}); });
} catch (e, s) { } catch (e, s) {
Logger.error(e, s); Logger.error(e, s);


Loading…
Cancel
Save