首先:app
import 'dart:async';async
直接上代码:spa
new Future(() { getGameConfig("bi_da_xiao"); }).then((_) {//此下划线提示getGameConfig方法的执行对下面的代码有重要影响(主要是这个参数:Game.game_config_value) var timer; timer = Timer.periodic( const Duration(milliseconds: 500), (Void) { if (Game.game_config_value != null) { (timer as Timer).cancel(); print("main_app : " + Game.game_config_value .toString()); Navigator .of(context) .pushNamed("/game/bi_da_xiao"); }else { print(" 这次为空"); } }); });