sticky method

Future<SubmissionRef> sticky({
  1. int number = 1,
})

Return a SubmissionRef that has been stickied on the subreddit.

number is used to specify which stickied Submission to return, where 1 corresponds to the top sticky, 2 the second, etc.

Implementation

Future<SubmissionRef> sticky({int number = 1}) async {
  try {
    await _throwOnInvalidSubreddit(() async => await reddit.get(
        apiPath['about_sticky']
            .replaceAll(SubredditRef._subredditRegExp, _name),
        params: {'num': number.toString()}));
  } on DRAWRedirectResponse catch (e) {
    return SubmissionRef.withPath(reddit, e.path);
  }
  // ignore: only_throw_errors
  throw 'This will never happen';
}