mapbox / mapbox/mapbox-maps-flutter

App Crashes when we use flyTo. It sporadic but consistently crashes after using a few times

Aperta
#982 0 commenti 5 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Dart
Stelle
380
Fork
204
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Users search locations and using the lat and long and we drop the pin for the location. This is the piece of code that does this. the flyTo crashes sometimes but if we just use setCamera it works. Is this a know issue? Have attached the stacktrace below as well.

```
Future _goToCurrentLocation(Position userPosition) async {
try {
final cameraOptions = CameraOptions(center: Point(coordinates: userPosition), zoom: 14.0,);
final animationOptions = MapAnimationOptions(duration: 2000, startDelay: 0,);
//fly to or ease to crashes. So we are using set camera
await _mapboxMap.flyTo(cameraOptions, animationOptions);
//await _mapboxMap.setCamera(cameraOptions);

if (_currentLocMarker != null) {
await _pointAnnotationManager.delete(_currentLocMarker!);
}
// Add a marker at current location
final annotationOptions = PointAnnotationOptions(
geometry: Point(coordinates: userPosition),
iconImage: personalMarkerPin,
iconSize: 1.0,);
_currentLocMarker = await _pointAnnotationManager.create(annotationOptions);
if (!mounted) {
return;
}
await context.read().getCompleteCurrentLocationMetaInfo(
latitude: double.parse(userPosition.lat.toString()),
longitude: double.parse(userPosition.lng.toString()));
}catch(err){
if (kDebugMode) {
print('----errror $err');
}
}

}

```

```
[mapbox-maps-flutter] [Error, maps-core]: {}[Render]: FillBucket: adding non-polygon geometry (LineString) to the fill-layer
[sentry.flutterError] [error] Exception caught by widgets library
'package:flutter/src/widgets/navigator.dart': Failed assertion: line 4064 pos 12: '!_debugLocked': is not true.
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:67:4)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:49:5)
#2 NavigatorState.dispose (package:flutter/src/widgets/navigator.dart:4064:12)
#3 StatefulElement.unmount (package:flutter/src/widgets/framework.dart:5922:11)
#4 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:2075:13)
#5 ListIterable.forEach (dart:_internal/iterable.dart:49:13)
#6 _InactiveElements._unmountAll (package:flutter/src/widgets/framework.dart:2084:25)
#7 BuildOwner.lockState (package:flutter/src/widgets/framework.dart:2965:15)
#8 BuildOwner.finalizeTree (package:flutter/src/widgets/framework.dart:3288:7)
#9 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1247:19)
#10 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:495:5)
#11 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1438:15)
#12 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1351:9)
#13 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1204:5)
#14 _rootRun (dart:async/zone.dart:1525:13)
#15 _CustomZone.run (dart:async/zone.dart:1422:19)
#16 _CustomZone.runGuarded (dart:async/zone.dart:1321:7)
#17 _invoke (dart:ui/hooks.dart:333:10)
#18 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:444:5)
#19 _drawFrame (dart:ui/hooks.dart:303:31)
flutter: ----errror PlatformException(channel-error, Unable to establish connection on channel: "dev.flutter.pigeon.mapbox_maps_flutter._AnimationManager.flyTo.0"., null, null)
[mapbox-maps-flutter] [Info, events_service]: Queue is empty, nothing to flush
[mapbox-maps-flutter] [Info, events_service]: Queue is empty, nothing to flush

======== Exception caught by widgets library =======================================================
The following assertion was thrown while finalizing the widget tree:
'package:flutter/src/widgets/navigator.dart': Failed assertion: line 4064 pos 12: '!_debugLocked': is not true.

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=02_bug.yml

When the exception was thrown, this was the stack:
#2 NavigatorState.dispose (package:flutter/src/widgets/navigator.dart:4064:12)
#3 StatefulElement.unmount (package:flutter/src/widgets/framework.dart:5922:11)
#4 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:2075:13)
#5 ListIterable.forEach (dart:_internal/iterable.dart:49:13)
#6 _InactiveElements._unmountAll (package:flutter/src/widgets/framework.dart:2084:25)
#7 BuildOwner.lockState (package:flutter/src/widgets/framework.dart:2965:15)
#8 BuildOwner.finalizeTree (package:flutter/src/widgets/framework.dart:3288:7)
#9 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1247:19)
#10 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:495:5)
#11 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1438:15)
#12 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1351:9)
#13 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1204:5)
#17 _invoke (dart:ui/hooks.dart:333:10)
#18 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:444:5)
#19 _drawFrame (dart:ui/hooks.dart:303:31)
(elided 5 frames from class _AssertionError and dart:async)
====================================================================================================

```

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia da _goToCurrentLocation e riproduci chiamate ripetute a flyTo usando le coordinate fornite, confrontando i percorsi flyTo e setCamera. Usa l’errore del canale di AnimationManager e l’assertion di disposal di NavigatorState riportati per isolare il problema; il lavoro è completato quando le chiamate ripetute a flyTo non causano più il crash segnalato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
dart, flutter
Ambito
mobile-dev
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.