tile2Lon method
converts the tile x to longitude. if the longitude is out of range then it is adjusted to the min/max longitude (-180/180)
Implementation
double tile2Lon(num x, num z) {
var xBounded = math.max(x, 0);
var lonDeg = xBounded / math.pow(2.0, z) * 360 - 180;
return lonDeg > 0
? math.min(lonDeg, 180).toDouble()
: math.max(lonDeg, -180).toDouble();
}