Node.fromJson constructor

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

Implementation

factory Node.fromJson(Map<String, dynamic> json) {
  return Node(
    nodeId: NodeId.fromJson(json['nodeId'] as int),
    parentId: json.containsKey('parentId')
        ? NodeId.fromJson(json['parentId'] as int)
        : null,
    backendNodeId: BackendNodeId.fromJson(json['backendNodeId'] as int),
    nodeType: json['nodeType'] as int,
    nodeName: json['nodeName'] as String,
    localName: json['localName'] as String,
    nodeValue: json['nodeValue'] as String,
    childNodeCount: json.containsKey('childNodeCount')
        ? json['childNodeCount'] as int
        : null,
    children: json.containsKey('children')
        ? (json['children'] as List)
            .map((e) => Node.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    attributes: json.containsKey('attributes')
        ? (json['attributes'] as List).map((e) => e as String).toList()
        : null,
    documentURL: json.containsKey('documentURL')
        ? json['documentURL'] as String
        : null,
    baseURL: json.containsKey('baseURL') ? json['baseURL'] as String : null,
    publicId:
        json.containsKey('publicId') ? json['publicId'] as String : null,
    systemId:
        json.containsKey('systemId') ? json['systemId'] as String : null,
    internalSubset: json.containsKey('internalSubset')
        ? json['internalSubset'] as String
        : null,
    xmlVersion:
        json.containsKey('xmlVersion') ? json['xmlVersion'] as String : null,
    name: json.containsKey('name') ? json['name'] as String : null,
    value: json.containsKey('value') ? json['value'] as String : null,
    pseudoType: json.containsKey('pseudoType')
        ? PseudoType.fromJson(json['pseudoType'] as String)
        : null,
    pseudoIdentifier: json.containsKey('pseudoIdentifier')
        ? json['pseudoIdentifier'] as String
        : null,
    shadowRootType: json.containsKey('shadowRootType')
        ? ShadowRootType.fromJson(json['shadowRootType'] as String)
        : null,
    frameId: json.containsKey('frameId')
        ? page.FrameId.fromJson(json['frameId'] as String)
        : null,
    contentDocument: json.containsKey('contentDocument')
        ? Node.fromJson(json['contentDocument'] as Map<String, dynamic>)
        : null,
    shadowRoots: json.containsKey('shadowRoots')
        ? (json['shadowRoots'] as List)
            .map((e) => Node.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    templateContent: json.containsKey('templateContent')
        ? Node.fromJson(json['templateContent'] as Map<String, dynamic>)
        : null,
    pseudoElements: json.containsKey('pseudoElements')
        ? (json['pseudoElements'] as List)
            .map((e) => Node.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    distributedNodes: json.containsKey('distributedNodes')
        ? (json['distributedNodes'] as List)
            .map((e) => BackendNode.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    isSVG: json.containsKey('isSVG') ? json['isSVG'] as bool : null,
    compatibilityMode: json.containsKey('compatibilityMode')
        ? CompatibilityMode.fromJson(json['compatibilityMode'] as String)
        : null,
    assignedSlot: json.containsKey('assignedSlot')
        ? BackendNode.fromJson(json['assignedSlot'] as Map<String, dynamic>)
        : null,
  );
}