vyuh_diagram_codec_json 2.17.0 copy "vyuh_diagram_codec_json: ^2.17.0" to clipboard
vyuh_diagram_codec_json: ^2.17.0 copied to clipboard

JSON codec for Vyuh Diagram.

vyuh_diagram_codec_json #

pub.dev

Save and restore diagram documents as JSON in pure Dart. Flutter already re-exports this codec.

Install #

dart pub add vyuh_diagram_codec_json

Save and restore #

With a controller, the installed extensions supply their codecs:

import 'package:vyuh_diagram_codec_json/vyuh_diagram_codec_json.dart';
import 'package:vyuh_diagram_core/vyuh_diagram_core.dart';

final controller = DiagramController();
controller.createShape(Shapes.rectangle, at: DiagramPoint.zero, text: 'Hello');
final json = controller.save(DiagramJsonCodec.new);
controller.load(json, format: DiagramJsonCodec.new);

Without a controller, encode and decode a document directly:

import 'package:vyuh_diagram_types/vyuh_diagram_types.dart';

const codec = DiagramJsonCodec(DiagramModelCodecs.empty());
final json = codec.encode(document);
final restored = codec.decode(json);

Use the same extensions when reopening a drawing. See persistence and the JSON format.

License #

Licensed under the Apache License, Version 2.0. Third-party materials retain their own licenses and notices.

0
likes
0
points
890
downloads

Publisher

verified publishervyuh.tech

Weekly Downloads

JSON codec for Vyuh Diagram.

Homepage

License

unknown (license)

Dependencies

vyuh_diagram_types

More

Packages that depend on vyuh_diagram_codec_json