我试图在对话框中显示谷歌地图,第一次它按预期弹出,但是第二次它抛出异常:StateError(错误状态:未来已经完成)。
Completer<GoogleMapController> _controller = Completer();
_displayDialog(){
Alert(
context: context,
style: alertStyle,
title: "Here are your results:",
content: Column(
children: <Widget>[
Container(
width: 200.0,
height: 200.0,
child: GoogleMap(
//mapType: MapType.hybrid,
initialCameraPosition: _kGooglePlex,
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller); //throws here in this line
},
),
),
],
),
Run Code Online (Sandbox Code Playgroud)
我在对话框中使用rflutter_alert: ^1.0.3,在地图中使用google_maps_flutter: ^0.5.21+15。
提前致谢!