diff --git a/lib/src/map_events.dart b/lib/src/map_events.dart index 9b9c6e47..69bf7c2d 100644 --- a/lib/src/map_events.dart +++ b/lib/src/map_events.dart @@ -16,7 +16,7 @@ final class _MapEvents { OnStyleImageUnusedListener? _onStyleImageUnusedListener; OnResourceRequestListener? _onResourceRequestListener; late final MethodChannel _channel; - List<_MapEvent> _subscribedEventTypes = []; + List<_MapEvent> subscribedEventTypes = []; List<_MapEvent> get eventTypes { final listenersMap = { @@ -54,7 +54,7 @@ final class _MapEvents { void updateSubscriptions() { final newEventTypes = eventTypes; - if (listEquals(newEventTypes, _subscribedEventTypes)) { + if (listEquals(newEventTypes, subscribedEventTypes)) { return; } @@ -62,7 +62,7 @@ final class _MapEvents { _channel.invokeMethod( "subscribeToEvents", newEventTypes.map((e) => e.index).toList()); - _subscribedEventTypes = newEventTypes; + subscribedEventTypes = newEventTypes; } void dispose() { diff --git a/lib/src/map_widget.dart b/lib/src/map_widget.dart index 3dfed730..67f66169 100644 --- a/lib/src/map_widget.dart +++ b/lib/src/map_widget.dart @@ -206,6 +206,7 @@ class _MapWidgetState extends State { 'mapboxPluginVersion': '2.5.0-rc.1', 'eventTypes': _events.eventTypes.map((e) => e.index).toList(), }; + _events.subscribedEventTypes = _events.eventTypes; return _mapboxMapsPlatform.buildView(widget.androidHostingMode, creationParams, onPlatformViewCreated, widget.gestureRecognizers,