decodedPolyline static method
Implementation
static List decodedPolyline(String? poly) {
var list1 = poly?.codeUnits;
var list2 = [];
int index = 0;
int? len = poly?.length;
int c = 0;
/// Repeating this until all attributes are decoded
do {
var shift = 0;
int value = 0;
/// Decoding value of one attribute
do {
c = list1![index] - 63;
value |= (c & 0x1F) << (shift * 5);
index++;
shift++;
} while (c >= 32);
///if value is negative
if (value & 1 == 1) {
value = ~value;
}
var value1 = (value >> 1) * 0.00001;
list2.add(value1);
} while (index < len!);
///Adding to previous value
for (var i = 2; i < list2.length; i++) list2[i] += list2[i - 2];
return list2;
}