update method

Future<void> update({
  1. String? name,
  2. Color? color,
  3. bool? hoist,
  4. String? emoji,
  5. bool? mentionable,
  6. String? reason,
})

Update the role.

await role.update(
  name: 'New Role Name',
  color: Color.blue_400,
  reason: 'Testing');

Implementation

Future<void> update(
    {String? name,
    Color? color,
    bool? hoist,
    String? emoji,
    bool? mentionable,
    String? reason}) async {
  await _datastore.role.update(
    id: id.value,
    serverId: serverId.value,
    reason: reason,
    payload: {
      if (name != null) 'name': name,
      if (color != null) 'color': color.toInt(),
      if (hoist != null) 'hoist': hoist,
      if (emoji != null) 'unicode_emoji': emoji,
      if (mentionable != null) 'mentionable': mentionable,
    },
  );
}