PermissionOverwrite.from constructor
PermissionOverwrite.from({
- required dynamic payload,
Implementation
factory PermissionOverwrite.from({required dynamic payload}) {
return PermissionOverwrite(
id: payload['id'],
type: payload['type'] is String
? PermissionOverwriteType.values.firstWhere((element) => element.name == payload['type'])
: PermissionOverwriteType.values.firstWhere((element) => element.value == payload['type']),
allow: Helper.bitfieldToPermissions(int.parse(payload['allow'].toString())),
deny: Helper.bitfieldToPermissions(int.parse(payload['deny'].toString())),
);
}