svg_painter_annotation 0.1.1 copy "svg_painter_annotation: ^0.1.1" to clipboard
svg_painter_annotation: ^0.1.1 copied to clipboard

Annotations for the svg_painter code generator, enabling compilation of SVGs into Flutter CustomPainters.

example/example.dart

import 'package:svg_painter_annotation/svg_painter_annotation.dart';

/// Example showing how to use the `@SvgPainter` annotation.
///
/// ## From an SVG file:
/// ```dart
/// @SvgPainter.file('assets/icons/star.svg')
/// class _StarPainter {}
/// ```
///
/// ## From inline SVG code:
/// ```dart
/// @SvgPainter.code('<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>')
/// class _DotPainter {}
/// ```
///
/// Then run: `dart run build_runner build`
///
/// The generated `StarPainter` and `DotPainter` classes extend Flutter's `CustomPainter`.
///
/// See the `svg_painter` package documentation for complete usage examples.
void main() {
  // Demonstrate the annotation constructors
  // ignore: unused_local_variable
  const SvgPainter fileBased = SvgPainter.file('assets/icon.svg');
  // ignore: unused_local_variable
  const SvgPainter codeBased = SvgPainter.code('<svg></svg>');
}
1
likes
160
points
109
downloads

Publisher

unverified uploader

Weekly Downloads

Annotations for the svg_painter code generator, enabling compilation of SVGs into Flutter CustomPainters.

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

meta

More

Packages that depend on svg_painter_annotation