A Flutter project demonstrating Google Maps, device location and route drawing with polylines.
- Google Maps — a full map view with markers, camera control and map styling.
- Device location — the
locationpackage resolves the device's current position and streams updates. - Polyline routes —
flutter_polyline_pointsturns a coordinate list into a drawn path between two points. - Permission handling — location permission is requested before the map starts tracking.
- Three focused files — map, tracking and entry point kept separate for clarity.
| Concern | Choice |
|---|---|
| UI | Flutter, Material |
| Maps | google_maps_flutter |
| Location | location |
| Routing | flutter_polyline_points |
lib/
├── googleMap.dart # Google Maps view, markers and polylines
├── location_tracking.dart # Location permission and position stream
└── main.dart
- Flutter
>= 3.16 - A Google Maps API key with the Maps SDK for Android and iOS enabled
minSdkVersion 21and the Maps renderer requirement inandroid/app/build.gradle
Add your key to android/app/src/main/AndroidManifest.xml:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY" />And to ios/Runner/AppDelegate.swift:
GMSServices.provideAPIKey("YOUR_API_KEY")git clone https://github.com/developer-rahim/Google-Location.git
cd Google-Location
flutter pub get
flutter runflutter test
flutter analyze- Google Maps does not render on an Android emulator without a valid API key — the map stays blank.
- Use a physical device to test real GPS tracking; the emulator returns a simulated location.
flutter_polyline_pointsneeds a decoded polyline string. For live routing, decode it from a Directions API response.
Released under the MIT License.