我已将以下库插入pubspec.yaml

  google_maps_flutter:
    git:
      url: git://github.com/flutter/plugins
      path: packages/google_maps_flutter

但每次我都会出错
Another exception was thrown: 'file:///C:/src/flutter/.pub-cache/git/plugins-aedcc6f81843ae2da3a6ac0c8e8c4b530d1ac035/packages/google_maps_flutter/lib/src/google_map.dart': Failed assertion: line 24 pos 15: 'initialCameraPosition != null': is not true.
事先谢谢。

最佳答案

只需在GoogleMap()中使用InitialCameraPosition
例如:

GoogleMap(
              onMapCreated: _onMapCreated,
              initialCameraPosition: CameraPosition(target: LatLng(51.5160895, -0.1294527),),
            )

关于flutter - 断言失败:第24行pos 15:'initialCameraPosition!= null':不是真的,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54455771/

10-10 17:57