ReactionType.fromJson constructor
Creates a ReactionType object from JSON object
Implementation
factory ReactionType.fromJson(Map<String, dynamic> json) {
switch (json['type']) {
case 'emoji':
return ReactionTypeEmoji.fromJson(json);
case 'custom_emoji':
return ReactionTypeCustomEmoji.fromJson(json);
default:
throw TeleverseException(
'Invalid reaction type: ${json['type']}',
description: 'The given type does not match any ReactionType.',
type: TeleverseExceptionType.invalidParameter,
);
}
}