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

[BUG] Unsupported operation: Infinity or NaN toInt #1759

Closed
RicardoRB opened this issue Dec 5, 2023 · 1 comment
Closed

[BUG] Unsupported operation: Infinity or NaN toInt #1759

RicardoRB opened this issue Dec 5, 2023 · 1 comment
Labels
bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing

Comments

@RicardoRB
Copy link

RicardoRB commented Dec 5, 2023

What is the bug?

When I'm launching my app in a --release mode, this exception is happening

I/flutter (25342): Unsupported operation: Infinity or NaN toInt
I/flutter (25342): #0      double.floor (dart:core-patch/double.dart)
I/flutter (25342): #1      PointExtension.floor (package:flutter_map/src/misc/point_extensions.dart:38)
I/flutter (25342): #2      MapCamera.pixelBoundsAtZoom (package:flutter_map/src/map/camera/camera.dart:262)
I/flutter (25342): #3      MapCamera.pixelBounds (package:flutter_map/src/map/camera/camera.dart:253)
I/flutter (25342): #4      MapCamera.visibleBounds (package:flutter_map/src/map/camera/camera.dart:67)
I/flutter (25342): #5      FlutterMapInternalController.move (package:flutter_map/src/map/controller/internal.dart:104)
I/flutter (25342): #6      FlutterMapInternalController.fitCamera (package:flutter_map/src/map/controller/internal.dart:245)
I/flutter (25342): #7      _FlutterMapStateContainer._applyInitialCameraFit (package:flutter_map/src/map/widget.dart:215)
I/flutter (25342): #8      _FlutterMapStateContainer._updateAndEmitSizeIfConstraintsChanged.<anonymous closure> (package:flutter_map/src/map/widget.dart:242)
I/flutter (25342): #9      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1325)
I/flutter (25342): #10     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1264)
I/flutter (25342): #11     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1113)
I/flutter (25342): #12     _invoke (dart:ui/hooks.dart:312)
I/flutter (25342): #13     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:383)
I/flutter (25342): #14     _drawFrame (dart:ui/hooks.dart:283)
E/flutter (25342): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Unsupported operation: Infinity or NaN toInt
E/flutter (25342): #0      _TileLayerState._clampToNativeZoom (package:flutter_map/src/layer/tile_layer/tile_layer.dart)
E/flutter (25342): #1      _TileLayerState._onTileUpdateEvent (package:flutter_map/src/layer/tile_layer/tile_layer.dart:610)
E/flutter (25342): #2      _TileLayerState.didChangeDependencies.<anonymous closure> (package:flutter_map/src/layer/tile_layer/tile_layer.dart:405)
E/flutter (25342): #3      _RootZone.runUnaryGuarded (dart:async/zone.dart:1594)
E/flutter (25342): #4      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339)
E/flutter (25342): #5      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271)
E/flutter (25342): #6      _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63)
E/flutter (25342): #7      _EventSinkWrapper.add (dart:async/stream_transformers.dart:13)
E/flutter (25342): #8      TileUpdateTransformers.ignoreTapEvents.<anonymous closure> (package:flutter_map/src/layer/tile_layer/tile_update_transformer.dart:37)
E/flutter (25342): #9      _HandlerEventSink.add (dart:async/stream_transformers.dart:209)
E/flutter (25342): #10     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111)
E/flutter (25342): #11     _RootZone.runUnaryGuarded (dart:async/zone.dart:1594)
E/flutter (25342): #12     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339)
E/flutter (25342): #13     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271)
E/flutter (25342): #14     _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123)
E/flutter (25342): #15     _MapStream._handleData (dart:async/stream_pipe.dart:218)
E/flutter (25342): #16     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153)
E/flutter (25342): #17     _RootZone.runUnaryGuarded (dart:async/zone.dart:1594)
E/flutter (25342): #18     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339)
E/flutter (25342): #19     _DelayedData.perform (dart:async/stream_impl.dart:515)
E/flutter (25342): #20     _PendingEvents.handleNext (dart:async/stream_impl.dart:620)
E/flutter (25342): #21     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:591)
E/flutter (25342): #22     _microtaskLoop (dart:async/schedule_microtask.dart:40)
E/flutter (25342): #23     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)
E/flutter (25342): 
E/flutter (25342): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Unsupported operation: Infinity or NaN toInt
E/flutter (25342): #0      _InheritOrCreatePopupScopeState._onMapEvent (package:flutter_map_marker_popup/src/state/inherit_or_create_popup_scope.dart)
E/flutter (25342): #1      _RootZone.runUnaryGuarded (dart:async/zone.dart:1594)
E/flutter (25342): #2      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339)
E/flutter (25342): #3      _DelayedData.perform (dart:async/stream_impl.dart:515)
E/flutter (25342): #4      _PendingEvents.handleNext (dart:async/stream_impl.dart:620)
E/flutter (25342): #5      _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:591)
E/flutter (25342): #6      _microtaskLoop (dart:async/schedule_microtask.dart:40)
E/flutter (25342): #7      _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)
E/flutter (25342): 
I/flutter (25342): Another exception was thrown: Instance of 'DiagnosticsProperty<void>'
I/flutter (25342): Another exception was thrown: Instance of 'DiagnosticsProperty<void>'
I/flutter (25342): Another exception was thrown: Instance of 'DiagnosticsProperty<void>'

How can we reproduce it?

Just opening the flutter map page:

FlutterMap(
            mapController: _mapController,
            options: MapOptions(
              onPositionChanged: (position, hasGesture) {
                if (hasGesture) {
                  setState(() {
                    _centerOnLocationUpdate = FollowOnLocationUpdate.never;
                    _showSearchHere = true;
                  });
                }
              },
              onTap: (_, __) => _popupController.hideAllPopups(),
              initialZoom: 15,
              initialCameraFit: CameraFit.coordinates(
                coordinates: [
                  _initLocation,
                ],
              ),
            ),
            children: [
              TileLayer(
                urlTemplate: "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
                subdomains: const ['a', 'b', 'c'],
                tileProvider: CachedTileProvider(),
              ),
              CurrentLocationLayer(
                followOnLocationUpdate: _centerOnLocationUpdate,
              ),
              PopupMarkerLayer(
                options: PopupMarkerLayerOptions(
                  popupController: _popupController,
                  markers: _markers,
                  popupDisplayOptions: PopupDisplayOptions(
                    builder: (buildContext, marker) {
                      if (marker is EstablishmentMarker) {
                        return EstablishmentMapMarker(
                          marker: marker,
                        );
                      }
                      return Container();
                    },
                  ),
                ),
              ),
              Align(
                alignment: Alignment.bottomRight,
                child: FloatingActionButton(
                  child: _locationIcon(_centerOnLocationUpdate),
                  onPressed: () async {
                    setState(() {
                      _centerOnLocationUpdate = FollowOnLocationUpdate.always;
                    });
                    final currentPosition =
                        await LocationClient.instance.findGeoPosition();
                    _mapController.move(
                      LatLng(
                        currentPosition.latitude,
                        currentPosition.longitude,
                      ),
                      _mapController.camera.zoom,
                    );
                  },
                ),
              ),
              SearchHereButtonLayer(
                searchHereButtonOpts: SearchHereButtonPluginOption(
                  visible: _showSearchHere,
                  onPressed: () async {
                    AnalyticsUtils.logEvent(
                      name: 'home_page_btn_search_here',
                    );
                    _markers.clear();
                    _homeBloc.add(MapGeoLocationRequest(
                      latitude: _mapController.camera.center.latitude,
                      longitude: _mapController.camera.center.longitude,
                    ));
                    setState(() {
                      _showSearchHere = false;
                    });
                  },
                ),
              ),
              Visibility(
                visible: _loading,
                child: Align(
                  alignment: Alignment.center,
                  child: Card(
                    shape: RoundedRectangleBorder(
                      side: BorderSide(
                        color: Theme.of(context).scaffoldBackgroundColor,
                        width: 2.0,
                      ),
                      borderRadius: BorderRadius.circular(4.0),
                    ),
                    child: const Padding(
                      padding: EdgeInsets.all(8.0),
                      child: Loading(),
                    ),
                  ),
                ),
              ),
              ZoomButtonsLayer(
                map: _mapController,
                zoomButtonsOpts: ZoomButtonsPluginOption(
                  alignment: Alignment.bottomLeft,
                  zoomInIcon: Theme.of(context).platform == TargetPlatform.iOS
                      ? CupertinoIcons.zoom_in
                      : Icons.zoom_in,
                  zoomOutIcon: Theme.of(context).platform == TargetPlatform.iOS
                      ? CupertinoIcons.zoom_out
                      : Icons.zoom_out,
                ),
              ),
            ],
          ),

Do you have a potential solution?

No response

Platforms

Android API 33

Severity

Erroneous: Prevents normal functioning and causes errors in the console

@RicardoRB RicardoRB added bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing labels Dec 5, 2023
@RicardoRB
Copy link
Author

RicardoRB commented Dec 5, 2023

I found the problem, I changed this:

initialCameraFit: CameraFit.coordinates(
  coordinates: [
    _initLocation,
  ],
),

to this:

initialCenter: _initLocation,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing
Projects
None yet
Development

No branches or pull requests

1 participant