crosspost method

Future<Submission> crosspost(
  1. Subreddit subreddit, {
  2. String? title,
  3. bool sendReplies = true,
})

Crosspost the submission to another Subreddit.

subreddit is the subreddit to crosspost the submission to, title is the title to be given to the new post (default is the original title), and if sendReplies is true (default), replies will be sent to the currently authenticated user's messages.

Note: crosspost is fairly new on Reddit and is only available to certain users on select subreddits who opted in to the beta. This method does work, but is difficult to test correctly while the feature is in beta. As a result, it's probably best not to use this method until crossposting is out of beta on Reddit (still in beta as of 2017/10/27).

Implementation

Future<Submission> crosspost(Subreddit subreddit,
    {String? title, bool sendReplies = true}) async {
  final data = <String, String?>{
    'sr': subreddit.displayName,
    'title': title ?? this.data!['title'],
    'sendreplies': sendReplies.toString(),
    'kind': 'crosspost',
    'crosspost_fullname': fullname,
    'api_type': 'json',
  };
  return (await reddit.post(apiPath['submit'], data)) as Submission;
}