I am new to Flutter (Dart) and this may be a basic question.
I got my current geolocation with geolocator API like the following:
Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
After getting the position, I was planning to set Lat and Long to separate variables for future use.
With a bit of struggle, I finally managed to figure out the right property to get Lat/Long information by type hint from Android Studio.
...
late double Lat;
late double Long;
...
Lat = snapshot.data!.latitude;
Long = snapshot.data!.longitude;
print("Lat is "+Lat.toString());
print("Long is "+Long.toString());
When typing 'snapshot.data!.', Android Studio shows options available. By looking at property names, I could have guessed which one of these should be the one. However, I don't believe relying on type hint is ideal way to find right property name.
For example, in Javascript, we can console.log() to get detailed information of a specific instance including accessible properties and we can tell property name with actual values at logged. I tried print() but it doesn't show a property name. (In above case, print(snapshot.data!.toString()) shows {Lat:xxx, Long:xxx}, but actual property names are 'latitude' and 'longitude').
Is there any general way to get detailed information of a specific instance including accessible properties in Dart?