title: Updating User Data in Cloud Firestore
body: <p>I've been having a problem trying to update data from a logged in user. I have the uid, but there has to be a connection between the uid and the collection of users, so that the program picks the right user to update, but I don't know how to make it.</p>
  
  <p>Here's what I have:</p>
  
  <pre><code>FirebaseUser loggedInUser;
  final _firestore = Firestore.instance;
  //
  double _latitude;
  double _longitude;
  
  void getCurrentLocation() async {
    try {
      Position position = await Geolocator()
        .getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
      setState(() {
        _latitude = position.latitude;
        _longitude = position.longitude;
      });
      _firestore
        .collection('users')
        .document('${loggedInUser.uid}')
        .updateData({'location': GeoPoint(_latitude, _longitude)});
    } catch (e) {
        print(e);
    }
  }
  </code></pre>
  
  <p>Here's what I've been getting:</p>
  
  <pre><code>E/flutter ( 9187): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(Error performing updateData, NOT_FOUND: No document to update: projects/app-#####/databases/(default)/documents/users/CGyByl58ELc0zirlVjJpv5OWAc42, null)
  </code></pre>
  
  <p>So it is using the right uid ("CGyByl58ELc0zirlVjJpv5OWAc42")</p>
  
  <p>Here's a screenshot from the <strong>Authentication</strong> tab of Firebase:
  <a href="https://i.stack.imgur.com/LFhel.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LFhel.png" alt="enter image description here"></a></p>
  
  <p>But what I'm trying to get is the name of the collection of this user in the database:
  <a href="https://i.stack.imgur.com/6D8XX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6D8XX.png" alt="enter image description here"></a></p>