flutter中Future.delayed延迟任务

使用了FlutterEasyLoading的showSuccess提示处理结果后,使用Future.delayed延迟跳转

void _showTipsAndJump() {
  EasyLoading.showSuccess("登录成功", duration: Duration(seconds: 2));
  Future.delayed(
    Duration(seconds: 2),
    () => Navigator.pushReplacement(
                  context, MaterialPageRoute(builder: (_) => HomePage())));
}

 

你可能感兴趣的:(flutter)