geo_location_finder 1.0.8 copy "geo_location_finder: ^1.0.8" to clipboard
geo_location_finder: ^1.0.8 copied to clipboard

Flutter plugin for getting accurate locations on the Android & iOS devices.

For help getting started with Flutter, view our online documentation.

Pub

geo_location_finder #

Flutter plugin for getting accurate locations on the Android & iOS devices.

Usage #


   // Get current latitude, longitude
   Future<void> _getLocation() async {
     Map<dynamic, dynamic> locationMap;

     String result;

     try {
       locationMap = await GeoLocation.getLocation;
       var status = locationMap["status"];
       if ((status is String && status == "true") ||
           (status is bool) && status) {
         var lat = locationMap["latitude"];
         var lng = locationMap["longitude"];

         if (lat is String) {
           result = "Location: ($lat, $lng)";
         } else {
           // lat and lng are not string, you need to check the data type and use accordingly.
           // it might possible that else will be called in Android as we are getting double from it.
           result = "Location: ($lat, $lng)";
         }
       } else {
         result = locationMap["message"];
       }
     } on PlatformException {
       result = 'Failed to get location';
     }

     if (!mounted) return;

     setState(() {
       _result = result;
     });
   }



1
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Flutter plugin for getting accurate locations on the Android & iOS devices.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on geo_location_finder