安卓系统上的google_maps_flutter崩溃NullPointerException



我在物理安卓设备(Oneplus 6t(上使用官方的google_maps_flutter插件,自从上次flutter升级以来,我在调用GoogleMap小部件时会出现黑屏。我目前在master分支。任何帮助都将不胜感激,谢谢。

插件版本google_maps_flutter:^0.0.3+3

再现的代码

_buildScaffold(LatLng position){
Scaffold s = new Scaffold(
key: _scaffoldKey,
appBar: buildAppBar(context),
resizeToAvoidBottomPadding: false,
body:
new Padding(
padding: new EdgeInsets.all(8.0),
child: widget.viewSwitchManager.mapView
? new Column(
children: [
new Flexible(
child: new Stack(
children: <Widget>[
google_maps.GoogleMap(
onMapCreated: _onMapCreated,
options: google_maps.GoogleMapOptions(
mapType: google_maps.MapType.normal,
myLocationEnabled: true,
cameraPosition: google_maps.CameraPosition(
target: google_maps.LatLng(position.latitude, 
position.longitude),
zoom: 11.0,
),
),
),

_showFloatingMapListButton(),
_showFloatingFiltersButton(),
]))
],
)
:
Stack(
children: <Widget>[
events != null ?
new Swiper(
loop: false,
itemBuilder: (BuildContext context, int index) {
EventTheTableLight event = events[index];
return EventSwiperCard(event: event);
},
itemCount: events.length,
viewportFraction: 0.8,
scale: 0.9,
) : SizedBox(),
_showFloatingMapListButton(),
_showFloatingFiltersButton(),
])

),
/*bottomNavigationBar: BottomAppBar(
child: new Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
icon: Icon(Icons.filter_list),
onPressed: () {
_filtersBottomSheet();
}),
SizedBox(width: MediaQuery.of(context).size.width/1.8,),
IconButton(
icon: Icon(Icons.refresh),
onPressed: () {
refreshEvents();
}),
],
),
),*/
);
if(widget.viewSwitchManager.mapView && gMapController != null) {
_buildMarkers(position);
gMapController.onMarkerTapped.add(_onMarkerTapped);
}
//if (!_searched)
//_updateMapCenter(position, 13.0);
return s;

日志:java.lang.NullPointerException:试图对null对象引用调用虚拟方法"double java.lang.double.doubleValue(("E/MethodChannel#flutter/platform_views(29682(:位于io.flutter.plugin.platform.PlatformViewsController.createPlatformView(PlatformViewsCoontroller.java:141(E/MethodChannel#flutter/platform_views(29682(:位于io.flutter.plugin.platform.PlatformViewsController.onMethodCall(PlatformViewsCoontroller.java:118(E/MethodChannel#flutter/platform_views(29682(:位于io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:200(E/MethodChannel#flutter/platform_views(29682(:位于io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163(E/MethodChannel#flutter/platform_views(29682(:在android.os.MessageQueue.naturePollOnce(Native Method(E/MethodChannel#flutter/platform_views(29682(:在android.os.MessageQueue.next(MessageQueue.java:326(E/MethodChannel#flutter/platform_views(29682(:在android.os.Looper.loop(Looper.java:160(E/MethodChannel#flutter/platform_views(29682(:位于android.app.ActivityThread.main(ActivityThreads.java:6683(E/MethodChannel#flutter/platform_views(29682(:位于java.lang.reflect.Method.ioke(Native Method(E/MethodChannel#flutter/platform_views(29682(:在com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537(E/MethodChannel#flutter/platform_views(29682(:在com.android.internal.os.ZygoteInit.main(ZygoteIndit.java:858(

我也有类似的问题,但通过替换地图视图的Expanded by Container解决了这个问题

相关内容

  • 没有找到相关文章

最新更新