title: Flutter Firestore Stream to json model error
body: <p>I'm trying to parse my Google Firestore stream query with my model using the from JSON method I'm getting an error 'argument_type_not_assignable' which I understand but not really sure what is the correct way to do this</p>
  <p>Here is my steam code</p>
  <pre><code>// Gets user as a stream
    Stream&lt;UserModel&gt; getUserStream() {
      final userId = _auth.currentUser?.uid;
      return usersCollection
          .doc(userId)
          .snapshots(
            includeMetadataChanges: true,
          )
          .map(
            (DocumentSnapshot&lt;Map&lt;String, dynamic&gt;&gt; snapshot) =&gt;
                UserModel.fromJson(snapshot.data()!),
          );
    }
  </code></pre>
  <p>The error I'm getting</p>
  <p>The argument type 'UserModel Function(DocumentSnapshot&lt;Map&lt;String, dynamic&gt;&gt;)' can't be assigned to the parameter type 'UserModel Function(DocumentSnapshot&lt;Object?</p>
  <p>Here is the user model</p>
  <pre><code>class UserModel {
    String userId;
    String email;
    String firstName;
    String lastName;
    @JsonKey(fromJson: dateTimeFromTimestamp, toJson: dateTimeAsIs)
    DateTime? recentTraining;
    @DocumentSerializerNullable()
    DocumentReference? recentTrainingRef;
    int dogsCount;
    int totalTrainingSessions;
    int totalTrainingTime; // in min
    int totalTrainingDays;
    @JsonKey(fromJson: dateTimeFromTimestamp, toJson: dateTimeAsIs)
    DateTime? createdAt;
    AccountType accountType;
    UserType userType;
    Subscription subscription;
    String? organization;
    String? organizationWebsite;
    String? role;
  
    UserModel({
      required this.userId,
      required this.email,
      required this.firstName,
      required this.lastName,
      required this.createdAt,
      required this.dogsCount,
      required this.totalTrainingSessions,
      required this.totalTrainingTime,
      required this.totalTrainingDays,
      required this.accountType,
      required this.userType,
      required this.subscription,
      this.recentTraining,
      this.recentTrainingRef,
      this.organization,
      this.organizationWebsite,
      this.role,
    });
  
    factory UserModel.fromJson(Map&lt;String, dynamic&gt; json) =&gt;
        _$UserModelFromJson(json);
  
    Map&lt;String, dynamic&gt; toJson() =&gt; _$UserModelToJson(this);
  }
  </code></pre>