Learn Pain Less

HomeOur TeamContact
Get Current Location in Flutter | Easily Track User's Location
Pawneshwer Gupta
Pawneshwer Gupta
March 04, 2023
2 min

Table Of Contents

Introduction to Flutter
What is Current Location?
Getting Current Location in Flutter
Get Current Location in Flutter | Easily Track User's Location

As mobile app developers, we understand the importance of getting the current location of a user in an application. It is a common requirement for many apps, especially those that require users to interact with the physical world around them. In this article, we will discuss how to get current location in Flutter, the popular open-source mobile app development framework.

Introduction to Flutter

Flutter is a modern, reactive, cross-platform mobile development framework created by Google. It allows developers to build high-performance, beautiful apps for iOS and Android platforms from a single codebase. Flutter provides rich sets of customizable widgets, tools, and libraries to build modern mobile apps. Flutter is based on the Dart programming language, which is easy to learn and has features that make it suitable for building mobile apps.

What is Current Location?

The current location is the geographical position of a mobile device. It is determined by GPS, Wi-Fi, and mobile networks. Knowing the current location of a user is essential for many apps, such as ride-sharing apps, weather apps, and maps. With the current location, apps can provide relevant and localized content, such as local weather forecasts, nearby places of interest, and local events.

Getting Current Location in Flutter

To get the current location in a Flutter app, we need to use the location package. The location package is a Flutter plugin that provides easy access to device location services. It supports both Android and iOS platforms and provides high accuracy location data.

To use the location package, we need to add it to our project’s pubspec.yaml file.

location: ^4.2.0

After adding the location package to the project, we can use it to get the current location.

import 'package:location/location.dart';
void getCurrentLocation() async {
var location = new Location();
try {
var currentLocation = await location.getLocation();
} catch (e) {

In the code above, we import the location package and create a new Location object. We then use the getLocation method to get the current location. The getLocation method returns a Future object that resolves to a LocationData object. The LocationData object contains the current latitude and longitude coordinates of the device.

We can then use the latitude and longitude coordinates to perform any necessary operations. For example, we can use them to display the user’s current location on a map or calculate the distance between the user’s current location and a destination.

You can also read Realtime location updates in flutter app to receive current location updates continuously.


In this article, we have discussed how to get the current location in Flutter. We have seen how the location package can be used to obtain high-accuracy location data from a mobile device. Flutter is an excellent platform for building mobile apps, and with the location package, we can easily integrate location-based functionality into our apps.

Learn Flutter in 90 days with Pawneshwer!

Dart Beginners Course in Hindi free of cost for limited period.

Start Learning







Subscribe to our newsletter!

We'll send you the best of our blog just once a month. We promise.


GuideLocationCurrent Location


Pawneshwer Gupta

Pawneshwer Gupta

Software Developer

Pawneshwer Gupta works as a software engineer who is enthusiastic in creating efficient and innovative software solutions.



Social Media

Related Posts

How to Refresh Specific Widget with setState using StatefulBuilder() in Flutter
How to Refresh Specific Widget with setState using StatefulBuilder() in Flutter
April 20, 2023
1 min
Learn Pain Less  © 2024, All Rights Reserved.
Crafted with by Prolong Services

Quick Links

Advertise with usAbout UsContact Us

Social Media