Skip to main content

svgkit 0.1.0 copy "svgkit: ^0.1.0" to clipboard
svgkit: ^0.1.0 copied to clipboard

Pure Dart SVG and SVGZ editing with paths, transforms, styles, resources, immutable snapshots, and bounded codecs.

example/svgkit_example.dart

import 'dart:convert';
import 'dart:typed_data';

import 'package:svgkit/svgkit.dart';

/// Edits SVG markup and performs an SVGZ round trip without a renderer.
void main() {
  final SvgDocument original = const SvgCodec().decode(utf8.encode('<svg xmlns="http://www.w3.org/2000/svg" width="100" height="80"><path id="triangle" d="M10 70L50 10L90 70Z" fill="red"/></svg>'));
  final XmlDocument xml = original.xml;
  xml.rootElement.setAttribute('viewBox', '0 0 100 80');
  final SvgDocument edited = SvgDocument.fromXml(document: xml);
  final Uint8List compressed = const SvgCodec(compressed: true).encode(edited);
  final SvgDocument reopened = const SvgCodec().decode(compressed);
  print('${reopened.width!.pixels} × ${reopened.height!.pixels}; SVGZ: ${compressed.length} bytes');
}
0
likes
160
points
834
downloads
screenshot

Documentation

API reference

Publisher

verified publisherfocale-editor.app

Weekly Downloads

Pure Dart SVG and SVGZ editing with paths, transforms, styles, resources, immutable snapshots, and bounded codecs.

Repository (GitHub)
View/report issues
Contributing

Topics

#svg #vector-graphics #document #codec #file-format

License

MIT (license)

Dependencies

xml, zcodec

More

Packages that depend on svgkit