title: Firestore geoPoint to Flutter nested objects
body: <p>I would like to create an object from a Firestore doc with a geoPoint. But I keep getting the error:
  &quot;Failed to get games: type 'GeoPoint' is not a subtype of type 'String?'&quot;</p>
  <p>This is my dataset on Firestore:</p>
  <p><a href="https://i.stack.imgur.com/zh9CP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zh9CP.png" alt="Firestore doc" /></a></p>
  <p>This is how I query Firestore:</p>
  <pre><code>    Future&lt;List&lt;GameItem&gt;&gt; getGamesInRegion() async {
        List&lt;GameItem&gt; _returnList = [];
        await FirebaseFirestore.instance
            .collection('games')
            .get()
            .then((querySnapshot) {
          for (var gameItemSnap in querySnapshot.docs) {              
            _returnList
                .add(GameItem.fromJson(gameItemSnap.id, gameItemSnap.data()));
          }
        }).catchError((error) =&gt; debugPrint(&quot;Failed to get games: $error&quot;));
  
        return _returnList;
      }
  </code></pre>
  <p>This is my GameItem Object:</p>
  <pre><code>import 'package:myproj/models/sk_location.dart';
  
    class GameItem {
      final String gameId;
      final String parentId;
      final String name;
      final int score;
      final SkLocation location;
  
      GameItem({
        required this.gameId,
        required this.parentId,
        required this.name,
        required this.score,
        required this.location,
      });
  
  
      factory GameItem.fromJson(String id, Map&lt;String, dynamic&gt; parsedJson) {
        return GameItem(
          gameId: id,
          parentId: parsedJson['parentId'] ?? '',
          name: parsedJson['name'] ?? '',
          score: parsedJson['score'] ?? '',
          location: SkLocation.fromJson(parsedJson['geoPoint']),
        );
      }
  
      toJson() {
        return {
          &quot;gameId&quot;: gameId,
          &quot;parentId&quot;: parentId,
          &quot;name&quot;: name,
          &quot;score&quot;: score,
          &quot;location&quot;: location,
        };
      }
    }
  </code></pre>
  <p>And this is my SkLocation Object:</p>
  <pre><code>  class SkLocation {
      final double lat;
      final double lng;
  
      SkLocation({required this.lat, required this.lng});
  
      factory SkLocation.fromJson(Map&lt;dynamic, dynamic&gt; parsedJson) {
        return SkLocation(
          lat: parsedJson['lat'],
          lng: parsedJson['lng'],
        );
      }
    }
  </code></pre>