I am new to DART. Is it possible to use Google Maps Javascript API on DART? If its not directly possible now, is there any other alternate way?
You can now use google_maps package available on pub. This library allows you to use Google Maps JavaScript API from dart scripts.
Simply add the dependency to your pubspec.yaml
dependencies:
google_maps: ">=1.0.1 <2.0.0"
Include the Maps API JavaScript using a <script>
tag.
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
Then you can use Google Maps from dart scripts. Here's a simple exemple :
import 'dart:html';
import 'package:google_maps/google_maps.dart';
void main() {
final mapOptions = new MapOptions()
..zoom = 8
..center = new LatLng(-34.397, 150.644)
..mapTypeId = MapTypeId.ROADMAP
;
final map = new GMap(query("#map_canvas"), mapOptions);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With