json_canvas 1.0.0 copy "json_canvas: ^1.0.0" to clipboard
json_canvas: ^1.0.0 copied to clipboard

A package that implemnents the JSON Canvas spec

Features #

A package that implements the JSON Canvas in Dart! You can easily use it in Flutter projects.

Usage #

import 'package:json_canvas/json_canvas.dart';


// Create a canvas
final myCanvas = Canvas();

// Create a text node
  final myTextNode = TextNode(
    id: 'unique-id-123',
    x: 0,
    y: 0,
    width: 100,
    height: 100,
    text: 'Hello Word!',
  );

// Add the node to the Canvas
myCanvas.addNode(myTextNode);

// Create another node
final myOtherTextNode = TextNode(
id: 'unique-id-999',
x: 100,
y: 100,
width: 100,
height: 100,
text: 'Hello Again, World!',
);

myCanvas.addNode(myOtherTextNode);

// Make a connection between the two nodes
myCanvas.addEdge(Edge(
    id: "edge-1",
    fromNode: myTextNode.id,
    toNode: myOtherTextNode.id,
    label: "Connection 1",
));

// Remove a node and all of its connections
myCanvas.removeNode(myTextNode.id);

// Export to JSON Canvas
myCanvas.toJson();

Additional information #

3
likes
140
pub points
0%
popularity

Publisher

unverified uploader

A package that implemnents the JSON Canvas spec

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on json_canvas