Skip to content

Run Sample App #397

@bruceo-beflex

Description

@bruceo-beflex
class MapWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new FlutterMap(
      layers: [
        TileLayerOptions(
            urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
            subdomains: ['a', 'b', 'c']),
      ],
      options: MapOptions(
        center: LatLng(51, 32),
        zoom: 5.0,
      ),
    );
  }
}

with sample code, i keep getting an error

flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following UnsupportedError was thrown building LayoutBuilder:
flutter: Unsupported operation: Infinity or NaN toInt
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0 double.toInt (dart:core-patch/double.dart:183:36)
flutter: #1 double.round (dart:core-patch/double.dart:151:34)
flutter: #2 CustomPoint.round
package:flutter_map/…/core/point.dart:42
flutter: #3 MapState.getNewPixelOrigin
package:flutter_map/…/map/map.dart:272
flutter: #4 MapState.size=
package:flutter_map/…/map/map.dart:91
flutter: #5 FlutterMapState.build.
package:flutter_map/…/map/flutter_map_state.dart:92
flutter: #6 _LayoutBuilderElement._layout.

CustomPoint getNewPixelOrigin(LatLng center, [double zoom]) {
var viewHalf = size / 2.0;
return (project(center, zoom) - viewHalf).round();
}

CustomPoint round() {
var x = this.x is double ? this.x.round() : this.x;
var y = this.y is double ? this.y.round() : this.y;
return CustomPoint(x, y);
}

when it runs round(), it causes an exception error and it say x is infinity on debug point.

Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions