route boxer for google map in flutter code example
Example: flutter draw google map
import 'package:google_maps_flutter/google_maps_flutter.dart';
static const LatLng _center = const LatLng(33.738045, 73.084488);
final Set<Marker> _markers = {};
final Set<Polyline>_polyline={};
LatLng _lastMapPosition = _center;
List<LatLng> latlng = List();
LatLng _new = LatLng(33.738045, 73.084488);
LatLng _news = LatLng(33.567997728, 72.635997456);
latlng.add(_new);
latlng.add(_news);
void _onAddMarkerButtonPressed() {
getDistanceTime();
setState(() {
_markers.add(Marker(
markerId: MarkerId(_lastMapPosition.toString()),
position: _lastMapPosition,
infoWindow: InfoWindow(
title: 'Really cool place',
snippet: '5 Star Rating',
),
icon: BitmapDescriptor.defaultMarker,
));
_polyline.add(Polyline(
polylineId: PolylineId(_lastMapPosition.toString()),
visible: true,
points: latlng,
color: Colors.blue,
));
});
GoogleMap(
polylines:_polyline,
markers: _markers,
onMapCreated: _onMapCreated,
myLocationEnabled:true,
onCameraMove: _onCameraMove,
initialCameraPosition: CameraPosition(
target: _center,
zoom: 11.0,
),
mapType: MapType.normal,
);
}