stream property

  1. @override
Stream<DTO?> Function(User user) get stream
override

Returns a stream of data for the authenticated user.

Implementation

@override
Stream<DTO?> Function(User user) get stream =>
    (user) =>
        streamBuilder?.call(user, api, this) ??
        switch (userIdLocation) {
          UserIdLocation.docId => api.streamByDocIdWithConverter(
            id: user.uid,
          ),
          UserIdLocation.field =>
            api
                .streamByQueryWithConverter(
                  whereDescription: '${api.userIdFieldName} == ${user.uid}',
                  collectionReferenceQuery: (collectionReference) =>
                      collectionReference.where(
                        api.userIdFieldName,
                        isEqualTo: user.uid,
                      ),
                )
                .map((event) => event.firstOrNull),
        };