Activity Feeds V3 is in closed alpha — do not use it in production (just yet).

Follows

Follow & Unfollow

// Follow a user
final timeline = client.feed(group: 'timeline', id: 'john');
await timeline.follow(targetFid: const FeedId(group: 'user', id: 'tom'));
// Follow a stock
await timeline.follow(targetFid: const FeedId(group: 'stock', id: 'apple'));
// Follow with more fields
await timeline.follow(
  targetFid: const FeedId(group: 'stock', id: 'apple'),
  custom: {'reason': 'investment'},
);

Querying Follows

// Do I follow a list of feeds
// My feed is timeline:john
const followQuery = FollowsQuery(
  filter: Filter.and([
    Filter.equal(FollowsFilterField.sourceFeed, 'timeline:john'),
    Filter.in_(FollowsFilterField.targetFeed, ['user:sara', 'user:adam']),
  ]),
);
final followList = client.followList(followQuery);
final page1 = await followList.get();
final page2 = await followList.queryMoreFollows();
final page1And2 = followList.state.follows;
// Paginating through followers for a feed
// My feed is timeline:john
const followerQuery = FollowsQuery(
  filter: Filter.equal(FollowsFilterField.targetFeed, 'timeline:john'),
);
final followerList = client.followList(followerQuery);
final followerPage1 = await followerList.get();

Follow Requests

Some apps require the user’s approval for following them.

// Sara needs to configure the feed with visibility = followers for enabling follow requests
const saraFeedQuery = FeedQuery(
  fid: FeedId(group: 'user', id: 'sara'),
  data: FeedInputData(visibility: FeedVisibility.followers),
);
final saraFeed = saraClient.feedFromQuery(saraFeedQuery);
await saraFeed.getOrCreate();

// Adam requesting to follow the feed
final adamTimeline = adamClient.feed(group: 'timeline', id: 'adam');
await adamTimeline.getOrCreate();
final followRequest =
    await adamTimeline.follow(targetFid: saraFeed.fid); // user:sara
print(followRequest.getOrNull()?.status); // .pending
// Sara accepting
await saraFeed.acceptFollow(
  sourceFid: adamTimeline.fid, // timeline:adam
  role: 'feed_member', // optional
);
// or rejecting the request
await saraFeed.rejectFollow(sourceFid: adamTimeline.fid); // timeline:adam

Push Preferences on Follow

When following a feed, you can set push_preference to control push notifications for future activities from that feed:

  • all - Receive push notifications for all activities from the followed feed
  • none (default) - Don’t receive push notifications for activities from the followed feed

Note: The push_preference parameter controls future notifications from the followed feed, while skip_push controls whether the follow action itself triggers a notification.

Examples: Push Preferences vs Skip Push

Understanding the difference between push_preference and skip_push:

// Scenario 1: Follow a user and receive notifications for their future activities
await timeline.follow("user:alice", {
  push_preference: "all"  // You'll get push notifications for Alice's future posts
});

// Scenario 2: Follow a user but don't get notifications for their activities
await timeline.follow("user:bob", {
  push_preference: "none"  // You won't get push notifications for Bob's future posts
});

// Scenario 3: Follow a user silently
await timeline.follow("user:charlie", {
  skip_push: true,  // Charlie won't get a "you have a new follower" notification
  push_preference: "all"  // But you'll still get notifications for Charlie's future posts
});

// Scenario 4: Silent follow with no future notifications
await timeline.follow("user:diana", {
  skip_push: true,        // Diana won't know you followed her
  push_preference: "none" // And you won't get notifications for her posts
});
© Getstream.io, Inc. All Rights Reserved.