setFlair method

Future<void> setFlair(
  1. dynamic redditor, {
  2. String text = '',
  3. String cssClass = '',
})

Sets the flair for a Redditor.

redditor can be either a String representing the Redditor's name or an instance of Redditor. Must not be null.

text is the flair text to associate with the Redditor.

cssClass is the CSS class to apply to the flair.

Implementation

Future<void> setFlair(/* Redditor, String */ redditor,
    {String text = '', String cssClass = ''}) {
  final redditorName = _redditorNameHelper(redditor);
  final data = <String, String>{
    'api_type': 'json',
    'css_class': cssClass,
    'name': redditorName,
    'text': text,
  };
  return _subreddit.reddit.post(
      apiPath['flair'].replaceAll(_kSubredditRegExp, _subreddit.displayName),
      data);
}