NetlistHierarchyAdapter.fromJson constructor

NetlistHierarchyAdapter.fromJson(
  1. String netlistJson, {
  2. String? rootNameOverride,
})

Convenience factory to parse a netlist JSON string directly.

rootNameOverride replaces the top-module name derived from the JSON. Use this when VCD scopes use instance names that differ from the definition names in the netlist output (often capitalized).

Implementation

factory NetlistHierarchyAdapter.fromJson(
  String netlistJson, {
  String? rootNameOverride,
}) {
  final obj = jsonDecode(netlistJson);
  if (obj is! Map<String, dynamic>) {
    throw const FormatException('Invalid netlist JSON root');
  }
  return NetlistHierarchyAdapter.fromMap(
    obj,
    rootNameOverride: rootNameOverride,
  );
}