Leaflet integration to Dart
Note: draft version, not all functionality supported.
Usage:
Manually import:
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
API wrappers follows reference: http://leafletjs.com/reference.html
Example:
_initMap() {
_map = new Leaflet.Map("map", new Leaflet.MapOptions(
center: new Leaflet.LatLng(60.222296, 24.929713),
zoom: 11));
new Leaflet.TileLayer(
'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}',
new Leaflet.TileLayerOptions(
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
maxZoom: 18,
id: 'your.project.id',
accessToken: 'your.access.token'
)).addTo(_map);
}
Also it includes extra util that supports conversion from Encoded Polyline Algorithm Format to List<LatLng> and back
List<LatLng> decoded = PolylineUtil.decode('_p~iF~ps|U_ulLnnqC_mqNvxq`@');
// returns a string-encoded polyline
String encoded = PolylineUtil.encode([new LatLng(38.5, -120.2), new LatLng(40.7, -120.95), new LatLng(43.252, -126.453)]);
Add this to your package's pubspec.yaml file:
dependencies:
leafletjs: ^0.0.0+1
You can install packages from the command line:
with pub:
$ pub get
Alternatively, your editor might support pub get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:leafletjs/leafletjs.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
0.0.0+2 | Jul 1, 2016 |
|
|
0.0.0+1 | Jun 26, 2016 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
20
|
Health:
Code health derived from static analysis.
[more]
|
--
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
--
|
Overall:
Weighted score of the above.
[more]
|
10
|
This package version is not analyzed, because it is more than two years old. Check the latest stable version for its analysis.
The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Running dartdoc
failed. (-10 points)
Make sure dartdoc
runs without any issues.
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=1.13.1 <2.0.0 |