edit method

Future<void> edit(
  1. String content, {
  2. String? reason,
})

Edits the content of the current page.

content is a markdown formatted String which will become the new content of the page.

reason is an optional parameter used to describe why the edit was made.

Implementation

Future<void> edit(String content, {String? reason}) async {
  final data = <String, String>{
    'content': content,
    'page': name,
  };
  if (reason != null) {
    data['reason'] = reason;
  }
  return reddit.post(
      apiPath['wiki_edit']
          .replaceAll(_kSubredditRegExp, _subreddit.displayName),
      data,
      discardResponse: true);
}