class Role { final String id; final String guildId; final String name; final int color; final int position; final List permissions; final bool isDefault; Role({ required this.id, required this.guildId, required this.name, this.color = 0, this.position = 0, List? permissions, this.isDefault = false, }) : permissions = permissions ?? []; factory Role.fromJson(Map json) { return Role( id: json['id'] as String, guildId: json['guild_id'] as String, name: json['name'] as String, color: json['color'] as int? ?? 0, position: json['position'] as int? ?? 0, permissions: (json['permissions'] as List?) ?.cast() ?? [], isDefault: json['is_default'] as bool? ?? false, ); } int get colorValue => color == 0 ? 0xFFB5BAC1 : color; }