mapbox / mapbox/mapbox-maps-flutter

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

Open
#982 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
380
Forks
204
PR merge metrics
No merged PRs in 30d

Description

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)
====================================================================================================

```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at _goToCurrentLocation and reproduce repeated flyTo calls using the provided coordinates, comparing the flyTo and setCamera paths. Use the reported AnimationManager channel error and NavigatorState disposal assertion to isolate the failure; done means repeated flyTo use no longer causes the reported crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.