I am using google map on my flutter application:
FlexibleSpaceBar(
background: GoogleMap(
mapType: MapType.terrain,
zoomGesturesEnabled: false,
zoomControlsEnabled: false,
initialCameraPosition: CameraPosition(
target: LatLng(
(widget.address.latitude).toDouble(),
(widget.address.longitude).toDouble()),
zoom: 14.4746,
),
onMapCreated: (GoogleMapController controller) {
mapController = controller;
},
I added google_maps_flutter_web: ^0.5.4+2 in yml file for flutter web and also I added :
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=mykey&callback=Function.prototype"></script>
in index.html.
Now when I am trying to use map controller and update new location :
mapController.animateCamera(
CameraUpdate.newLatLngZoom(
LatLng(
new double,
new double),
14));
I am getting this error :
You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.
Google Maps JavaScript API has been loaded directly without loading=async. This can result in suboptimal performance. For best-practice loading patterns please see https://goo.gle/js-api-loading
Caught error: InvalidValueError: not a LatLng or LatLngLiteral with finite coordinates: in property lat: not a number
and just zoom will set.