fromJson static method

Property fromJson(
  1. dynamic jsonNode,
  2. ASTBuilder builder
)

Implementation

static Property fromJson(var jsonNode, ASTBuilder builder) {
  if (jsonNode['kind'] != 'init') {
    throw Exception(
        'currently function calls to initialize properties of an object are unsupported');
  }
  Expression key = builder.buildNode(jsonNode['key']) as Expression;
  if (!(key is Literal) && !(key is Identifier)) {
    throw Exception("Property key must be either Literal or Identifier");
  }
  return Property(key, builder.buildNode(jsonNode['value']) as Expression);
}