create method

Future<WikiPage> create(
  1. String name,
  2. String content, {
  3. String? reason,
})

Creates a new WikiPage.

name is the name of the page. All spaces are replaced with '_' and the name is converted to lowercase.

content is the initial content of the page.

reason is the optional message explaining why the page was created.

Implementation

Future<WikiPage> create(String name, String content, {String? reason}) async {
  final newName = name.replaceAll(' ', '_').toLowerCase();
  final newPage = WikiPageRef(_subreddit.reddit, _subreddit, newName);
  await newPage.edit(content, reason: reason);
  return await newPage.populate();
}