tagNodeFromJson function

TagNode tagNodeFromJson(
  1. dynamic rawJson
)

Implementation

TagNode tagNodeFromJson(dynamic rawJson) {
  if (rawJson is DJson) {
    return switch (rawJson['type']) {
      'property' => PropertyTag.fromJson(rawJson),
      'text' => TextNode.fromJson(rawJson),
      'widget' => WidgetTag.fromJson(rawJson),
      'unknown' => UnknownNode.fromJson(rawJson),
      _ => throw Exception('Incorrect type of json: ${rawJson.runtimeType}'),
    } as TagNode;
  }
  throw Exception('Incorrect type of json: ${rawJson.runtimeType}');
}