rohd_schematic_viewer 0.2.1 copy "rohd_schematic_viewer: ^0.2.1" to clipboard
rohd_schematic_viewer: ^0.2.1 copied to clipboard

ROHD Schematic Viewer - Standalone Flutter schematic viewer for Yosys JSON netlists

example/main.dart

// Copyright (C) 2026 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// main.dart
// Example of embedding the ROHD Schematic Viewer in a Flutter application.
//
// 2026 September
// Author: Desmond Kirkpatrick <desmond.a.kirkpatrick@intel.com>

/// Example of embedding the ROHD Schematic Viewer in a Flutter application.
library;

import 'package:material_ui/material_ui.dart';
import 'package:rohd_schematic_viewer/schematic_viewer.dart';

const _exampleNetlist = r'''
{
  "creator": "rohd_schematic_viewer example",
  "modules": {
    "ExampleTop": {
      "attributes": {
        "top": 1
      },
      "ports": {
        "a": {
          "direction": "input",
          "bits": [1]
        },
        "b": {
          "direction": "input",
          "bits": [2]
        },
        "y": {
          "direction": "output",
          "bits": [3]
        }
      },
      "cells": {
        "and_gate": {
          "type": "$_AND_",
          "port_directions": {
            "A": "input",
            "B": "input",
            "Y": "output"
          },
          "connections": {
            "A": [1],
            "B": [2],
            "Y": [3]
          }
        }
      },
      "netnames": {
        "a": {
          "bits": [1]
        },
        "b": {
          "bits": [2]
        },
        "y": {
          "bits": [3]
        }
      }
    }
  }
}
''';

/// Runs an application containing an embedded schematic viewer.
void main() => runApp(const _ExampleApp());

class _ExampleApp extends StatelessWidget {
  const _ExampleApp();

  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'Embedded ROHD Schematic Viewer',
        debugShowCheckedModeBanner: false,
        theme: ThemeData.light(),
        darkTheme: ThemeData.dark(),
        home: Scaffold(
          appBar: AppBar(title: const Text('Embedded Schematic')),
          body: const EmbeddedSchematicViewer.fromJson(
            schematicJson: _exampleNetlist,
          ),
        ),
      );
}
2
likes
160
points
584
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

ROHD Schematic Viewer - Standalone Flutter schematic viewer for Yosys JSON netlists

Homepage
Repository (GitHub)
View/report issues
Contributing

License

BSD-3-Clause (license)

Dependencies

file_selector, flutter, flutter_bloc, flutter_js, flutter_web_plugins, material_ui, package_info_plus, rohd, rohd_devtools_widgets, rohd_hierarchy, rohd_source_navigator, web

More

Packages that depend on rohd_schematic_viewer