Erik Tovar Juarez
 · CEO at Hulux Telecom

Help decode json

i have a custom function to decode the Lat and Long out of a json input
here is the code made by AI

try { final Map<String, dynamic> data = json.decode(entrada);

final double lat = data['lat'];

final double lng = data['lng'];

return LatLng(lat, lng);

} catch (e) { return null; }

This is the input json

{

"lat": "20.2655675064",

"lng": "-98.9367720276"

}

But i always get NULL

Ive asked the AI in different ways but the code it gives me is usually the same.

Can anyone help? please

2
4 replies