Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlatformException on hot reload #514

Open
JanWeidenhammer opened this issue Oct 17, 2024 · 0 comments
Open

PlatformException on hot reload #514

JanWeidenhammer opened this issue Oct 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@JanWeidenhammer
Copy link

Platforms

iOS

Version of flutter maplibre_gl

0.20.0

Bug Description

When hot reloading the app on a IPhone XR an Platform Exception is thrown and the Map is blank this has also happend in Production when the App runs for a long time.

Steps to Reproduce

  1. Hot reload App

Expected Results

App should restart as normal

Actual Results

throws exceptiond and shows blank Map

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PlatformException(recreating_view, trying to create an already created view, view id: '0', null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:646:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)

#2 PlatformViewsService.initUiKitView (package:flutter/src/services/platform_views.dart:248:5)

#3 _DarwinViewState._createNewUiKitView (package:flutter/src/widgets/platform_view.dart:921:36)

Code Sample

MapLibreMap(
                        logoViewMargins: const Point(0, double.maxFinite),
                        compassViewMargins:
                            Point(12, Debug.debugOrAdmin ? 260 + ApplicationSizes.topPadding : 95 + ApplicationSizes.topPadding),
                        trackCameraPosition: true,
                        initialCameraPosition: preCamPos ?? MapManager.cameraHandler.initialCameraPosition,
                        doubleClickZoomEnabled: true,
                        onMapClick: (point, coordinates) {
                          if (widget.onMapClicked != null) {
                            widget.onMapClicked!(point, coordinates);
                          }
                          MapManager.instance.clearHighlightedSymbol();
                          FlingBoxManager.instance.close();
                        },
                        dragEnabled: true,
                        myLocationEnabled: false,
                        tiltGesturesEnabled: false,
                        onMapCreated: (controller) async {
                          Debug.map("Map Created!", force: true);

                          await MapManager.instance.setController(controller);

                          if (ApplicationConfig.instance.useCupertino) {
                            final newInsets = EdgeInsets.only(
                              bottom: useMobileLayout ? ApplicationSizes.flingboxBaseHeaderHeight : 0,
                              left: useMobileLayout ? 0 : ApplicationSizes.flingBoxWidth,
                            );
                            MapManager.instance.controller?.updateContentInsets(newInsets);
                          }
                        },
                        styleString: snapshot.data!,
                        onStyleLoadedCallback: () {
                          Debug.map("Style changed...");
                          MapManager.instance.reloadManager();
                        },
                        annotationOrder: const [
                          AnnotationType.circle,
                          AnnotationType.line,
                          AnnotationType.fill,
                          AnnotationType.symbol,
                        ],
                      )
@JanWeidenhammer JanWeidenhammer added the bug Something isn't working label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant