callback转async
class ViewUtil {
///界面初始化完成
static Future<Void> initFinish() async {
Completer<Void> completer = Completer();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
completer.complete();
});
return completer.future;
}
}
void _init() async {
var s = await ViewUtil.initFinish();
print(s);
}