fromJson method
Implementation
@override
RichText fromJson(dynamic json) {
if (json is String) {
return RichText.plain(text: json);
}
if (json is List) {
return RichText.collection(
texts: json.map((e) => const RichTextConverter().fromJson(e)).toList(),
);
}
if (json is Map<String, dynamic>) {
return RichText.fromJson(json);
}
throw TeleverseException(
'Invalid RichText JSON',
type: TeleverseExceptionType.invalidParameter,
);
}