File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ onCameraChangeListener(CameraChangedEventData data) {
1212* Print to console native Maps SDK logs in debug configuration.
1313Logs are proxied only in debug configuration and can be disabled completely by passing environment flag ` MAPBOX_LOG_DEBUG ` with false value.
1414* Fix rare crash in ` Snapshotter ` . The crash could happen when creating/destroying multiple instances of ` Snapshotter ` in succession.
15- * Fix crash in Snapshotter when GlyphsRasterizationMode is specified in MapSnapshotOptions.
15+ * Fix a crash that occurs when the widget state is updated before the platform view is created.
16+ * Fix a crash in Snapshotter when GlyphsRasterizationMode is specified in MapSnapshotOptions.
1617
1718# 2.3.0
1819
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ class _MapWidgetState extends State<MapWidget> {
176176 late final BinaryMessenger _binaryMessenger =
177177 ProxyBinaryMessenger (suffix: _suffix.toString ());
178178 late final _MapEvents _events;
179-
179+ bool _platformViewCreated = false ;
180180 MapboxMap ? mapboxMap;
181181
182182 @override
@@ -217,7 +217,10 @@ class _MapWidgetState extends State<MapWidget> {
217217 super .didUpdateWidget (oldWidget);
218218
219219 _updateEventListeners ();
220- _events.updateSubscriptions ();
220+
221+ if (_platformViewCreated) {
222+ _events.updateSubscriptions ();
223+ }
221224 }
222225
223226 void _updateEventListeners () {
@@ -249,5 +252,8 @@ class _MapWidgetState extends State<MapWidget> {
249252 widget.onMapCreated !(controller);
250253 }
251254 mapboxMap = controller;
255+
256+ _events.updateSubscriptions ();
257+ _platformViewCreated = true ;
252258 }
253259}
You can’t perform that action at this time.
0 commit comments