decode static method
Decodes an encoded path string into a sequence of LatLngs.
Implementation
static List<Point<double>> decode(final String encodedPath) {
final len = encodedPath.length;
final path = <Point<double>>[];
int index = 0;
int lat = 0;
int lng = 0;
while (index < len) {
int result = 1;
int shift = 0;
int b;
do {
b = encodedPath.codeUnitAt(index++) - 63 - 1;
result += b << shift;
shift += 5;
} while (b >= 0x1f);
lat += (result & 1) != 0 ? ~(result >> 1) : (result >> 1);
result = 1;
shift = 0;
do {
b = encodedPath.codeUnitAt(index++) - 63 - 1;
result += b << shift;
shift += 5;
} while (b >= 0x1f);
lng += (result & 1) != 0 ? ~(result >> 1) : (result >> 1);
path.add(Point(lat * 1e-5, lng * 1e-5));
}
return path;
}