Using Geolocator to Communicate with the GPS and Build a Map in Dart's Flutter Framework

What Will I Learn?

  • You will learn about the Geolocator Flutter plugin
  • You will learn how to ping the GPS in a Flutter application
  • You will learn how to use Google's static map API to build a map in Flutter
  • You will learn how to use Streams to fetch Channel Messages

Requirements

Difficulty

  • Intermediate

Description

In this Flutter video tutorial, we look at the various applications of the Geolocation plugin. We also look at how the Google Static Map's API can be used in conjuncture with Geolocation to build a map. The Geolocation makes calls to the native platforms, iOS and Android, to their GPS APIs and then feeds that information into the Flutter layer of our application using Channel Messages. As with many Flutter plugins, we can take advantage of existing APIs from the native platforms to build our applications.

We first build a list application that periodically pings out to the GPS to fetch the current location of the device. As we change the location of the device the latitude and longitude of the location also changes. We make use of a Stream Subscription to fetch the data in a continuous manner. We then build out a map application using the Google Static Map API to generate a network image for us. By fetching the Latitude and Longitude from our device's GPS, we can then make a request to the network to re-generate the map and make it look as though the map is seminative. Various features could be added to this map to make it feel more fluid such as a gesture detector and a more consistent polling method.

The source code for this project can be found here

Video Tutorial

Projects and Series

Stand Alone Projects:
Building a Calculator
Movie Searcher Application

Minesweeper Game

Curriculum



Posted on Utopian.io - Rewarding Open Source Contributors

H2
H3
H4
3 columns
2 columns
1 column
6 Comments