subscribe method

Future<void> subscribe({
  1. List<SubredditRef>? otherSubreddits,
})

Subscribes to the subreddit.

When otherSubreddits is provided, the provided subreddits will also be subscribed to.

Implementation

Future<void> subscribe({List<SubredditRef>? otherSubreddits}) async {
  final data = {
    'action': 'sub',
    'skip_initial_defaults': 'true',
    'sr_name': _subredditList(this, otherSubreddits),
  };
  await _throwOnInvalidSubreddit(() async =>
      await reddit.post(apiPath['subscribe'], data, discardResponse: true));
}