maplibre / flutter-maplibre-gl

Customizable, performant and vendor-free vector and raster maps, flutter wrapper for maplibre-native and maplibre-gl-js (fork of flutter-mapbox-gl/maps)
https://pub.dev/packages/maplibre_gl
Other
226 stars 125 forks source link

[BUG] <title>updateAcquireFence: Did not find frame #519

Open YuneshShrestha opened 2 weeks ago

YuneshShrestha commented 2 weeks ago

Platforms

android

Version of flutter maplibre_gl

^0.20.0

Bug Description

image

"updateAcquireFence: Did not find frame" continues logging but stops logging if I don't use MapLibreMap.

Steps to Reproduce

  1. Add MapLibre package
  2. Using it:

    
    MapLibreMap(
          logoViewMargins: const Point(-50, -50),
          onMapCreated: (MapLibreMapController controller) async {
            if (!mapController.libreMapController.isCompleted) {
              mapController.libreMapController.complete(controller);
            }
          },
          onCameraIdle: () {
            // Check if the map controller is available and if we have a valid starting position
            if (!(mapController.fromLatLng.value != null &&
                mapController.markers.isEmpty)) {
              return;
            }
    
            if (mapController.libreMapController.isCompleted) {
              mapController.libreMapController.future.then((controller) {
                final currentCameraPosition = controller.cameraPosition;
    
                // Only execute if the camera position has changed
                if (currentCameraPosition != null) {
                  final newLatLng = currentCameraPosition.target;
                  if (lastMapPosition == null ||
                      newLatLng.latitude != lastMapPosition?.latitude ||
                      newLatLng.longitude != lastMapPosition?.longitude) {
                    // Update the last known map position
                    lastMapPosition = newLatLng;
    
                    mapController.fromLocationCameraMove(newLatLng);
    
                    // Get the location name from latlng
                    mapController
                        .getAddressFromLatLng(LatLng(
                      newLatLng.latitude,
                      newLatLng.longitude,
                    ))
                        .then((value) async {
                      debugPrint("Location Address: $value");
                    });
                  }
                }
              });
            }
          },
          trackCameraPosition: true,
          myLocationEnabled: true,
          myLocationTrackingMode: MyLocationTrackingMode.tracking,
          initialCameraPosition: const CameraPosition(
              target: LatLng(27.7192873, 85.3238007), zoom: 14.0),
          styleString:
              "https://api.baato.io/api/v1/styles/breeze?key=${AppConstants.baatoApi}",
        ),

### Expected Results

"updateAcquireFence: Did not find frame" should not be displayed.

### Actual Results

"updateAcquireFence: Did not find frame" should not be displayed.

### Code Sample

MapLibreMap( logoViewMargins: const Point(-50, -50), onMapCreated: (MapLibreMapController controller) async { if (!mapController.libreMapController.isCompleted) { mapController.libreMapController.complete(controller); } }, onCameraIdle: () { // Check if the map controller is available and if we have a valid starting position if (!(mapController.fromLatLng.value != null && mapController.markers.isEmpty)) { return; }

        if (mapController.libreMapController.isCompleted) {
          mapController.libreMapController.future.then((controller) {
            final currentCameraPosition = controller.cameraPosition;

            // Only execute if the camera position has changed
            if (currentCameraPosition != null) {
              final newLatLng = currentCameraPosition.target;
              if (lastMapPosition == null ||
                  newLatLng.latitude != lastMapPosition?.latitude ||
                  newLatLng.longitude != lastMapPosition?.longitude) {
                // Update the last known map position
                lastMapPosition = newLatLng;

                mapController.fromLocationCameraMove(newLatLng);

                // Get the location name from latlng
                mapController
                    .getAddressFromLatLng(LatLng(
                  newLatLng.latitude,
                  newLatLng.longitude,
                ))
                    .then((value) async {
                  debugPrint("Location Address: $value");
                });
              }
            }
          });
        }
      },
      trackCameraPosition: true,
      myLocationEnabled: true,
      myLocationTrackingMode: MyLocationTrackingMode.tracking,
      initialCameraPosition: const CameraPosition(
          target: LatLng(27.7192873, 85.3238007), zoom: 14.0),
      styleString:
          "https://api.baato.io/api/v1/styles/breeze?key=${AppConstants.baatoApi}",
    ),