Get Current Location Flutter Using Location Manager | Simplified
This is me, we gonna look at how to get location from the device Android, Ios and Web as well.
It's quite straight forward by using the following flutter dependency.
location | Flutter Package
This plugin for Flutter handles getting location on Android and iOS. It also provides callbacks when location is…
Following the above documentation, we can get set up permissions, enable location in the device and get the current location as well.
So what I did something new here is create a manager class that still does the same thing but in an efficient manner in the coolest way.
Before start, I’m from the android kotlin platform so I used the same architecture we follow in android development.
Firstly, Implement the location dependency inside pubspec.yml
Create a state for location.
the LocationManger would be,
That's would do the work :).
Everywhere you want just call like below,
Here we go the simplest way to get the current location anywhere from screens.
Any suggestions are welcome.
Thank you for reading ;)