In my flutter google maps project, after first install I can't see the blue dot of my gps location(current location) on every other opening of the app it works properly. Please help me to understand the issue and to fix the issue.

I used geoLocation package for get current location. Also add the location permissions in android manifest file.

Method I used to get the current location

  _getCurrentLocation() async {
final GoogleMapController controis = await _controller.future;
await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high)
    .then((Position position) async {
  setState(() {
    _currentPosition = position;
    // ignore: avoid_print
    print("current position: $_currentPosition");
    controis.animateCamera(
      CameraUpdate.newCameraPosition(
        CameraPosition(
            target: LatLng(position.latitude, position.longitude), zoom: 5),
      ),
    );
  });
  await _getAddress();
}).catchError((e) {
  print(e);
});

}

0

There are 0 best solutions below