How to get GPS location with Dart ? (mobile)

Issue

I would like to get the exact GPS location of the connected user by using the actual GPS of the phone for mobile users. Using DART.

Solution

You have to use getCurrentPosition or watchPosition. Note that those methods take several optional named parameters. By default, the location is not necessarly the most accurate and you have to use geolocation.getCurrentPosition(enableHighAccuracy: true) to get better precision.

But be careful to the battery usage. Depending on the parameters you use the battery consumption will really change.

Answered By – Alexandre Ardhuin

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *