TextContent.fromJson constructor

TextContent.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory TextContent.fromJson(Map<String, dynamic> json) {
  return TextContent(
    format: TextFormat.values.firstWhere(
      (e) => e.toString().split('.').last == json['format'],
      orElse: () => TextFormat.plain,
    ),
    value: json['value'] as String,
  );
}