We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Zoom level not initialized error


I'm using the Syncfusion map widget for my project, and it was working fine until I made the screen that holds the map stateful. Now, after a setState() occurs, I get the following error when trying to move around:

LateInitializationError: Field '_zoomLevel@115372349' has not been initialized

I've tried using just MapZoomPanBehavior() for the zoom pan behavior parameter and the same thing happened, so It doesn't seem like I forgot to initialize it. As for the initialZoomLevel of the whole map, it is determined by a class field marked "final", so that should be initialized too.

1 Reply

YG Yuvaraj Gajaraj Syncfusion Team March 22, 2023 11:45 AM UTC

Hi Afonso,

Yes, this issue may occur when you do not initialize a local field in initState. If you have a local variable for the MapZoomPanBehavior then you must need to initialize it in the initState method before it is assigned to the zoomPanBehavior property in the MapShapeLayer or MapTileLayer in the SfMaps. We have shared the related UG documentation below for your reference.

UG, https://help.syncfusion.com/flutter/maps/zoom-pan



Live Chat Icon For mobile
Up arrow icon