Google Maps Flutter plugin method not working as expected

Viewed 222

I have been using google maps for flutter in Android Studio for about two months and now the GoogleMapsController.animateCamera is throwing this exception:

[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException
(No implementation found for method camera#animate on channel plugins.flutter.io/google_maps_0)

The only new code that has been introduced between it working and not working is this method:

void searchAndNavigate() {
    Geolocator().placemarkFromAddress(searchAddress).then((result) async {
      final GoogleMapController controller = await _controller.future;
      controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(
        target:
          LatLng(result[0].position.latitude, result[0].position.longitude), zoom: 15.0)));
    });

  }

The method that I also want to use and that was working before the introduction of this new method is:

Future<void> setLocation(LocationData location) async {
    final GoogleMapController controller = await _controller.future;
    LatLng newLocation = LatLng(location.latitude, location.longitude);
    CameraPosition cameraPosition = CameraPosition(
      zoom: 15.0,
      target: newLocation,
    );

    await controller.animateCamera(CameraUpdate.newCameraPosition(cameraPosition));
    await getData(newLocation);
  }

Anyone have any idea why this is happening? I have recompiled the application and run flutter doctor/upgrade/clean

0 Answers
Related