ElementNode.fromJson constructor

ElementNode.fromJson(
  1. Map<Object?, Object?> json
)

An element from lang-core's JSON form (isElementNodeJson); props that are element or AST objects become nodes. A missing hasDynamicProps is true, as in lang-core.

Implementation

factory ElementNode.fromJson(Map<Object?, Object?> json) {
  if (!isElementNodeJson(json)) {
    throw ArgumentError.value(json, 'json', 'not an ElementNode');
  }
  return ElementNode(
    typeName: json['typeName']! as String,
    props: _fromJsonValue(json['props'])! as Map<String, Object?>,
    partial: json['partial']! as bool,
    hasDynamicProps: json['hasDynamicProps'] != false,
    statementId: json['statementId'] as String?,
  );
}