How dened/svg2dart works
Project type and purpose
• This is an open-source command-line tool and build_runner plugin (“svg2dart”) that reads SVG data and generates high-performance Flutter widgets in pure Dart.
• It ships as a global CLI (bin/svg2dart.dart) and as a builder for build_runner (in lib/src/svg2dart_builder.dart).
File structure
• Top-level:
• bin/ : entry point for the CLI
• lib/ : core code under lib/src
• tool/ : helper scripts (e.g., finish_feature.dart)
• build.yaml : builder configuration defaults
• example/ : a full Flutter app demonstrating usage on Android, iOS, macOS, Linux, Windows, Web
• test/ : unit tests
• .github/ : CI workflows (checkout, deploy, tests-report)
• Inside lib/src:
• svg_reader.dart : parses SVG paths, fills, gradients
• code_generator.dart : turns parsed SVG data into Dart widget code
• generator_options.dart : CLI and builder flags/options
• svg2dart_builder.dart : defines the build_runner Builder
README
• Describes two usage modes:
a. CLI: reads input path, outputs Dart files
b. build_runner plugin: integrated into Dart/Flutter dev workflow
• Mentions preserved directory structure, self-contained widgets, and configuration via build.yaml.
Detail
• How build.yaml configures the builder’s input/output defaults
• generator_options as the central orchestrator linking CLI flags or builder options to the pipeline
• Example’s multi-platform structure to demonstrate end-to-end workflow