random method
Returns a random submission from the Subreddit.
Implementation
Future<SubmissionRef> random() async {
try {
await _throwOnInvalidSubreddit(() async => await reddit.get(
apiPath['subreddit_random']
.replaceAll(SubredditRef._subredditRegExp, _name)));
} on DRAWRedirectResponse catch (e) {
// We expect this request to redirect to our random submission.
return SubmissionRef.withPath(reddit, e.path);
}
// ignore: only_throw_errors
throw 'This will never happen';
}