首先: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(" 這次爲空"); } }); });