我正在使用插件 google_maps_flutter 1.2.0,我想实例化一个 GoogleMapController 来测试一些块的事件,其中控制器的值不能为空。不幸的是,我不知道该怎么做,因为据我所知,GoogleMapController 无法在 GoogleMap() Widget 的“OnCreated”函数之外实例化。
GoogleMap(onMapCreated: (GoogleMapController controller) {
// Can only be instanciate here
},
);
Run Code Online (Sandbox Code Playgroud)
不可能做这样的事情:
GoogleMapController controller = new GoogleMapsController();
Run Code Online (Sandbox Code Playgroud)
我只能这样做,并且控制器为 null :
GoogleMapController controller;
Run Code Online (Sandbox Code Playgroud)
我尝试了多种方法,但没有任何效果,有人可以帮助我吗?