parse method

  1. @override
Role parse(
  1. Map<String, Object?> raw
)
override

Parse the raw data received from the API into an instance of the type of this manager.

Implementation

@override
Role parse(Map<String, Object?> raw) {
  return Role(
    id: Snowflake.parse(raw['id']!),
    manager: this,
    name: raw['name'] as String,
    color: DiscordColor(raw['color'] as int),
    isHoisted: raw['hoist'] as bool,
    iconHash: raw['icon'] as String?,
    unicodeEmoji: raw['unicode_emoji'] as String?,
    position: raw['position'] as int,
    permissions: Permissions(int.parse(raw['permissions'] as String)),
    isMentionable: raw['mentionable'] as bool,
    tags: maybeParse(raw['tags'], parseRoleTags),
    flags: RoleFlags(raw['flags'] as int),
  );
}