由于一些奇怪的原因,我在AlertDialog
电话后无法显示await
。对话框刚好拒绝出现。但是,如果我注释掉await
来电,则会显示对话框。
void selectImage() async {
var _fileName = await ImagePicker.pickImage(
source: ImageSource.gallery, maxWidth: 250.0, maxHeight: 250.0);
showDialog(
context: context,
builder: (BuildContext context) => new AlertDialog(
content: new Text("Random question?"),
actions: <Widget>[
new FlatButton(
onPressed: () => Navigator.pop(context),
child: const Text("NO")),
new FlatButton(
onPressed: (() {
Navigator.pop(context);
setState(() {
imageFile = _fileName;
});
}),
child: const Text("YES"))
],
));
}
拜托,我做错了什么?