Fireship · @fireship

Flutter Google Maps + Firestore Geolocation - Build the next Uber?

Uploaded February 15, 2019 · Length 11:46

Flutter Google Maps + Firestore Geolocation - Build the next Uber?

Summary

Build a real-time geolocation app with Flutter, Google Maps, and Firestore, similar to Uber, in under 200 lines of code.

  • flutter google maps
  • firestore geolocation
  • real-time location tracking
  • flutter app development
  • google maps api

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    [Music]

  2. 0:06

    geolocation is pretty important like

  3. 0:09

    uber is the highest-valued private tech

  4. 0:10

    company in the world with a valuation of

  5. 0:12

    over 100 billion and the core feature of

  6. 0:14

    that app is real-time geolocation in

  7. 0:16

    today's video we'll build some of the

  8. 0:18

    most important features that go into an

  9. 0:19

    app like uber such as device GPS

  10. 0:21

    tracking and real-time geolocation

  11. 0:23

    queries to a cloud database and we'll do

  12. 0:25

    it all in under two hundred lines of

  13. 0:26

    code using tools like flutter Google

  14. 0:28

    Maps and firestorm if you're new here

  15. 0:30

    like and subscribe and I highly

  16. 0:31

    recommend following along with the

  17. 0:33

    source code on fire ship IO and a huge

  18. 0:35

    shout out to darshan goda not only did

  19. 0:37

    he write most of the code for this video

  20. 0:38

    but he's also the author of the geo

  21. 0:40

    flutter fire library that powers the geo

  22. 0:42

    queries that you'll see in this video

  23. 0:44

    let's start by taking a closer look at

  24. 0:46

    the app you'll notice it's a full-screen

  25. 0:48

    google map and then we have a slider

  26. 0:50

    down here in the left corner and a

  27. 0:51

    button in the right corner in flutter we

  28. 0:53

    can arrange this layout very simply in a

  29. 0:55

    stack when we move the slider to the

  30. 0:57

    right it will zoom out the camera and

  31. 0:58

    also increase the range of our geo query

  32. 1:00

    so the app allows you to find all of the

  33. 1:02

    safe points within a certain radius of a

  34. 1:04

    center point and more often than not

  35. 1:06

    that center point will be the actual

  36. 1:07

    users device location via GPS and the

  37. 1:10

    button down here on the right allows us

  38. 1:11

    to add a new geo point to firestore

  39. 1:13

    based on the device's current location

  40. 1:15

    but the really awesome thing is that we

  41. 1:17

    can update the markers on the map by

  42. 1:19

    reacting to events in the database so

  43. 1:21

    you can see as this blue dot moves and

  44. 1:23

    we add additional geo points they show

  45. 1:24

    up on the map instantly that means you

  46. 1:26

    could have multiple users listening to

  47. 1:28

    the same stream of geo location data and

  48. 1:30

    they would all get the same results in

  49. 1:31

    the UI similar to that ubirr app how

  50. 1:33

    everybody can see the same drivers

  51. 1:34

    moving around in real time now let's go

  52. 1:36

    ahead and get started

  53. 1:37

    the first thing you'll need to do is

  54. 1:38

    have flood or fire installed you can

  55. 1:41

    refer to the official documentation

  56. 1:42

    where I cover all the steps in the

  57. 1:44

    Google OAuth Water video when you create

  58. 1:46

    a firebase project it also gives you a

  59. 1:48

    GCP project where you can obtain a

  60. 1:50

    Google Maps API key once you have the

  61. 1:53

    API enabled go ahead and copy that API

  62. 1:55

    key and then we'll bring it into our

  63. 1:56

    flutter project now let's take a look at

  64. 1:58

    our dependencies we have firebase core