Skip to content

LatLng is not finite: LatLng(latitude:NaN, longitude:NaN) from map_interactive_viewer.dart #2199

@matisiekpl

Description

@matisiekpl

What is the bug?

Map is stuck and stacktrace is thrown:

_Exception: Exception: LatLng is not finite: LatLng(latitude:NaN, longitude:NaN)
#0      Crs.checkLatLng (package:flutter_map/src/geo/crs.dart:82)
#1      Epsg3857.latLngToOffset (package:flutter_map/src/geo/crs.dart:189)
#2      MapCamera.projectAtZoom (package:flutter_map/src/map/camera/camera.dart:278)
#3      MapCamera.offsetToCrs (package:flutter_map/src/map/camera/camera.dart:400)
#4      MapInteractiveViewerState._handleScaleStart (package:flutter_map/src/gestures/map_interactive_viewer.dart:549)
#5      ScaleGestureRecognizer._dispatchOnStartCallbackIfNeeded.<fn> (package:flutter/src/gestures/scale.dart:787)
#6      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:345)
#7      ScaleGestureRecognizer._dispatchOnStartCallbackIfNeeded (package:flutter/src/gestures/scale.dart:786)
#8      ScaleGestureRecognizer.acceptGesture (package:flutter/src/gestures/scale.dart:809)
#9      _CombiningGestureArenaMember.acceptGesture (package:flutter/src/gestures/team.dart:51)
#10      GestureArenaManager._resolveByDefault (package:flutter/src/gestures/arena.dart:275)
#11      GestureArenaManager._tryToResolveArena.<fn> (package:flutter/src/gestures/arena.dart:255)
#12      _microtaskLoop (dart:async/schedule_microtask.dart:40)
#13      _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)

How can we reproduce it?

git clone https://github.com/matisiekpl/flutter_map_supercluster
cd flutter_map_supercluster/example
flutter build ios
flutter run ios

# After launching app, go to any map from drawer and try to move in mulitple directions. After few moves, you should get grey screen.

Doctor output:

[✓] Flutter (Channel stable, 3.41.6, on macOS 26.4.1 25E253 darwin-arm64, locale pl-PL)

Do you have a potential solution?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions