Working in Dart with Geolocation. The geoposition object passed to the callback does not always have altitude, speed or direction. My question is how I check for this to prevent an exception from being thrown?
I know I can use exception handling but would prefer to detect the situation. At least in the Dart Editor the debugger pauses execution, it seems, even if the exception is caught...
I've tried
if(solution.coords.altitude==null) { ... }
if(solution.coords.altitude is num) { ... }
These cause exceptions. In the debugger altitude does not show as an available field in the object. On a device, with the right settings, altitude is included.
How do I deal with this? Surely there is some way to test that the optional fields are there or not.
Just to reiterate, the fields are not showing up, they do not show as null, they are not there.
Thanks in advance for any help.