Hello everyone,
This is another topic I had a problem with. To get real time weather data from api, you need to use Current Device Location as parameter but unfortunately, current action in FF is not supported because of the type of data it gives.
To handle this, I used this custom code. This is removes non-digit characters from data.
For example, If you have data like below;
LatLng(lat: 28.5530, lng: 77.59386)
It will be changed like;
28.553,77.59386
So you can use it for your api's.
Enjoy!
SS;
Code below;
/// MODIFY CODE ONLY BELOW THIS LINE
// remove LatLng(lat: , lng: , ) from the word
if (latlong == null) {
return null;
}
final regex = RegExp(r'LatLng\(lat: (.*), lng: (.*)\)');
final match = regex.firstMatch(latlong);
if (match != null && match.groupCount == 2) {
final lat = double.tryParse(match.group(1)!);
final lng = double.tryParse(match.group(2)!);
if (lat != null && lng != null) {
return '$lat,$lng';
}
}
return null;
/// MODIFY CODE ONLY ABOVE THIS LINE