Hello Guys, How Are You All ? Hope You All Are Very Well. As a Flutter developer Sometimes you need device current lattitude and Longitude. So in This tutorial we are going to learn how to get device lat long in flutter

how to get device lat long in flutter
How to Get Device Lat Long in Flutter
First of all. All You Need is GeoLocation package. So define on pubspec.yaml file and then get that dependencies. Same like below.
dependencies:
flutter:
sdk: flutter
geolocation: ^1.1.2
Now. For Android Users, you Must have to define below both line in your Flutter_project_path/android/app/src/main/AndroidManifest.xml File Exactly Like below.


For iOS users, You need to declare the description for the desired permission in ios/Runner/Info.plist:

NSLocationWhenInUseUsageDescription
Reason why app needs location
NSLocationAlwaysAndWhenInUseUsageDescription
Reason why app needs location

NSLocationAlwaysUsageDescription
Reason why app needs location


Now, import geolocation.dart in your file where you want lat and long.
import ‘package:geolocation/geolocation.dart’;
Define latitude and longitude that you want to use. In my case i need lat long in String Formate so i am defining String.
String latitude = ‘00.00000’;
String longitude = ‘00.00000’;
Now Create Method named _getCurrentLocation with async Like Below.

Full Article At How to Get Device Lat Long in Flutter

How to Get Device Lat Long in Flutter
1.60 GEEK