4

I have implement a polyline in flutter

Map<PolylineId, Polyline> _mapPolylines = {};
  int _polylineIdCounter = 1;

  void _add() {
    final String polylineIdVal = 'polyline_id_$_polylineIdCounter';
    _polylineIdCounter++;
    final PolylineId polylineId = PolylineId(polylineIdVal);

    final Polyline polyline = Polyline(
      polylineId: polylineId,
      consumeTapEvents: true,
      color: Colors.red,
      width: 5,
      jointType: JointType.round,
      points: points, //_createPoints(),
    );

    setState(() {
      _mapPolylines[polylineId] = polyline;
    });
  }



and display it on the map

    return new GoogleMap(
        mapType: MapType.normal,
        markers: Set.from(Markers),
        initialCameraPosition: _kGooglePlex,
        polylines: Set<Polyline>.of(_mapPolylines.values),
        onMapCreated: (GoogleMapController controller) async {
          _controller.complete(controller);
        });

I am using google_maps_flutter package and i am trying to indicate direction to my route.

Michail Geek
  • 81
  • 1
  • 5
  • There seems to be a related [feature request](https://github.com/flutter/flutter/issues/17832) for google_maps_flutter in Github. Might be helpful for you to comment your use-case there and request to support arrows. – smga08 Jun 05 '20 at 06:35
  • You can use the endCap or startCap property of polyline to customize the look at the vertices of the polyline. But arrowheads are not available by default so you would have to use custom caps. See this for reference: https://pub.dev/documentation/google_maps_flutter_platform_interface/latest/google_maps_flutter_platform_interface/Cap/customCapFromBitmap.html – Mervin Samy Jun 10 '20 at 03:50

0 Answers0