Get Current Location Flutter Using Location Manager | Simplified
Hi,
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.
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
dependencies:
location: ^3.0.0
Then,
Create a state for location.
And
the LocationManger would be,
That's would do the work :).
Finnaly,
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 ;)
Reference