mapbox_gl_dart 0.2.0 copy "mapbox_gl_dart: ^0.2.0" to clipboard
mapbox_gl_dart: ^0.2.0 copied to clipboard

Platformweb
outdated

Mapbox-gl wrapper for Dart. Library to use Mapbox GL JS in your web Dart projects.

Mapbox-gl wrapper for Dart #

Library to use Mapbox GL JS from Dart. Working examples here: https://andrea689.github.io/mapbox-gl-dart/

Using this package #

You must include Mapbox GL JS into your .html file to be able to use this package.

<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.css' rel='stylesheet'/>

In the body add a container for the map.

<body>
    <div id='map'></div>
</body>

In the dart file initialize the map.

import 'package:mapbox_gl_dart/mapbox_gl_dart.dart' as mapboxgl;

void main() {
  Mapbox.accessToken = 'YOUR_TOKEN_HERE';

  var map = MapboxMap(
    MapOptions(
      container: 'map',
      style: 'mapbox://styles/mapbox/dark-v10',
      center: LngLat(7.68227, 45.06755),
      zoom: 12,
    ),
  );
}

Examples #

You can find many examples in the example folder.

Run example #

pub global activate webdev

webdev serve example:8081

Open browser to localhost:8081

7
likes
130
pub points
49%
popularity

Publisher

unverified uploader

Mapbox-gl wrapper for Dart. Library to use Mapbox GL JS in your web Dart projects.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

js

More

Packages that depend on mapbox_gl_dart