FirebaseFollowSource class final

FollowDataSource backed by Cloud Firestore.

Follow documents are stored in two sub-collections per user:

  • users/{userId}/followers/{followerId} — who follows the user.
  • users/{userId}/following/{targetId} — who the user follows.

A root follows collection is also maintained for easy querying.

Implemented types

Constructors

FirebaseFollowSource({FirebaseFirestore? firestore})
Creates a FirebaseFollowSource.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

follow({required String followerId, required String targetId}) Future<void>
Records that followerId is following targetId.
override
getFollowers(String userId, {int? limit}) Future<List<String>>
Returns IDs of users following userId.
override
getFollowing(String userId, {int? limit}) Future<List<String>>
Returns IDs of users that userId is following.
override
isFollowing({required String followerId, required String targetId}) Future<bool>
Returns true when followerId is following targetId.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
unfollow({required String followerId, required String targetId}) Future<void>
Removes the follow relationship from followerId to targetId.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited