toListGeo method

Future<List<GeoPoint>> toListGeo()

Implementation

Future<List<GeoPoint>> toListGeo() async {
  final String polylineEncoded = this;
  try {
    return await compute((String encoded) {
      final listPoints = decodePolyline(encoded, accuracyExponent: 5);
      return listPoints
          .map(
            (e) => GeoPoint(
              latitude: e.first.toDouble(),
              longitude: e.last.toDouble(),
            ),
          )
          .toList();
    }, polylineEncoded);
  } catch (e) {
    return [];
  }
}