pub repository
mirror.p-hatan.irvector_graphics_compiler
1.3.0A compiler to convert SVGs to the binary format used by `package:vector_graphics`.
Readme
vector_graphics_compiler
A compiler for package:vector_graphics.
This package parses SVG files into a format that the vector_graphics runtime can render.
Features
Supported SVG features:
- Groups, paths, and basic shapes are all supported.
- References, including out of order references.
- Linear and radial gradients, including radial gradients with focal points.
- Text
- Symbols
- Images
- Patterns
Unsupported SVG features:
- Filters
- Some text processing attributes
Optimizations:
- Opacity peepholing
- Transformation inlining (except for text and radial gradients)
- Group collapsing
- Mask and clip elimination
Commemoration
This package was originally authored by Dan Field and has been forked here from dnfield/vector_graphics. Dan was a member of the Flutter team at Google from 2018 until his death in 2024. Dan’s impact and contributions to Flutter were immeasurable, and we honor his memory by continuing to publish and maintain this package.
Changelog
1.3.0
- An unrecognized
font-weightvalue is now ignored with a warning (and still throws whenwarningsAsErrorsis set) instead of always throwing. This preserves an inherited weight, or the initial normal weight at the root, and lets the compiler tolerate non-standard values such asregularemitted by some SVG generators.
1.2.6
- Fixes
linux-arm64host support by selecting the Flutter engine artifact directory fromAbi.current()instead of a hardcodedlinux-x64.
1.2.5
- Updates allowed version range of
xmlto include up to 7.0.1.
1.2.4
- Fix Stack Overflow crashes caused by circular references (masks, patterns, deferred nodes, and clip paths).
- Prevent CPU/Memory Denial of Service (DoS) resource exhaustion from exponential DAG reference expansions (Billion Laughs SVG exploits) by enforcing a strict, cumulative reference expansion safety limit of 1,000.
- Updates minimum supported SDK version to Flutter 3.38/Dart 3.10.
1.2.3
- Fixes the SVG parser injecting a spurious space between adjacent
<tspan>elements that have no whitespace between them in the source. Previously<tspan>A</tspan><tspan>B</tspan>was emitted as"A"+" B", producing a visible gap; it now emits"A"+"B"to match every browser.
1.2.2
- Adds support for modern space-separated HSL and HSLA color syntax.
1.2.1
- Fixes HSL/HSLA color parsing for decimal percentage components (e.g.
hsl(270, 100%, 76.27%)).
1.2.0
- Adds support for percentage units in SVG shape attributes (rect, circle, ellipse, line).
1.1.20
- Fixes color parsing for modern rgb and rgba CSS syntax.
- Updates minimum supported SDK version to Flutter 3.35/Dart 3.9.
1.1.19
- Updates allowed version range of
xmlto include up to 6.6.1. - Updates minimum supported SDK version to Flutter 3.29/Dart 3.7.
1.1.18
- Updates minimum supported SDK version to Flutter 3.27/Dart 3.6.
- Fixes SVG matrix parsing to explicitly set the Z scale value.
1.1.17
- Fixes a bug where stroke opacity not applied by color mapper.
1.1.16
- Sets stroke-width to 1 by default when an invalid value is parsed instead of throwing an exception.
1.1.15
- Fixes a bug where empty tags caused the parser to crash.
1.1.14
- Makes the package WASM compatible.
1.1.13
- Relaxes dependency constraint on vector_graphics_codec.
1.1.12
- Transfers the package source from https://github.com/dnfield/vector_graphics to https://github.com/flutter/packages.
1.1.11+1
- Relax package:http constraint.
1.1.11
- Use package:http to drop dependency on dart:html.
1.1.10+1
- Add missing save before clip.
1.1.10
- Add missing clip before saveLayer.
1.1.9+2
- Fix case sensitivity on scientific notation parsing.
1.1.9+1
- Fix publication error that did not have latest source code.
1.1.9
- Fix handling of invalid XML
@idattributes. - Fix handling of self-referential
<use/>elements. - Add
--out-diroption to compiler. - Tweak warning message for unhandled eleemnts.
1.1.8
- Fix bugs in transform parsing.
1.1.7
- Support for matching the ambient text direction.
1.1.6
- Fix bug in text position computation when transforms are involved.
1.1.5+1
- Remove/update some invalid assertions related to image formats.
1.1.5
- Support for encoding path control points as IEEE 754-2008 half precision
floating point values using the option
--use-half-precision-control-points. - Added an error builder property to provide a fallback widget on exceptions.
1.1.4
- Support more image formats and malformed MIME types.
- Fix inheritence for
fill-rules.
1.1.3
- Further improvements to whitespace handling for text.
1.1.2
- Fix handling and inheritence of
none.
1.1.1
- Multiple text positioning bug fixes.
- Preserve stroke-opacity when specified.
1.1.0
- Fix a number of inheritence related bugs:
- Inheritence of properties specified on the root element now work.
- Opacity inheritence is more correct now.
- Inheritence of
useelements is more correctly handled.
- Make
currentColornon-null on SVG theme, and fix how it is applied. - Remove the opacity peephole optimizer, which was incorrectly applying optimizations in a few cases. A future release may add this back.
- Add clipBehavior to the widget.
- Fix patterns when multiple patterns are specified and applied within the graphic.
1.0.1
- Fix handling of unspecified fill colors on use/group elements.
1.0.0+1
- Fix issue in pattern decoding.
- Fix issue in matrix parsing for some combinations of matrices.
1.0.0
- Initial stable release.
- Parsing is now synchronous, and is easier to work with in tests.
- Correctly handle images with
ids and defined indefsblocks. - Compile time color remapping support.
0.0.3
- Better concurrency support
- Pattern support.
- Bug fixes around image handling.
- Bug fix for when optimizers are used on non-default fill types.
- Support for SVG theme related properties (currentColor, font-size, x-height).
0.0.2
- Add optimizations for masks, clipping, and overdraw.
0.0.1
- Create repository
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add vector_graphics_compilerpubspec.yaml
name: vector_graphics_compiler
description: A compiler to convert SVGs to the binary format used by `package:vector_graphics`.
repository: https://github.com/flutter/packages/tree/main/packages/vector_graphics_compiler
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+vector_graphics%22
version: 1.3.0
executables:
vector_graphics_compiler:
environment:
sdk: ^3.10.0
dependencies:
args: ^2.3.0
meta: ^1.7.0
path: ^1.8.0
path_parsing: ^1.0.1
vector_graphics_codec: ^1.1.11+1
# This uses an exact upper range because it is an external dependency (see
# https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#dependencies
# for more information), and this mitigates transitive risk exposure to
# clients. To update this value:
# - Audit the package's source diffs between the current max version listed
# here and the target version.
# - Update the max version here to exactly the audited version.
xml: ">=6.3.0 <=7.0.1"
dev_dependencies:
flutter:
sdk: flutter
flutter_test:
sdk: flutter
test: ^1.20.1
vector_graphics: ^1.1.13
vector_math: ^2.1.2
platforms:
android:
ios:
linux:
macos:
web:
windows:
topics:
- svg
- vector-graphics
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.0.0 | 2022-02-28T20:55:56.510283Z | Download | 70349fb17e479b46f68710c6de0905028ca30386e68ed33dacaa6d78544b54cf |
| 0.0.1 | 2022-07-26T21:57:18.875743Z | Download | 522c2bedfc7f94ab2a6e69fe790ed38bc5b2a328bf4af05f43f416ce825cefb4 |
| 0.0.2 | 2022-08-10T18:25:19.451216Z | Download | 245962288390c2467617819186bbfd397f2c4a9ff68133d53d42734ada568688 |
| 0.0.3 | 2022-10-26T23:26:32.899123Z | Download | a7ce5a1065943763f91d0fe47fe7dc293e593f3258ac6c781b72247ef802d467 |
| 0.0.4 | 2022-11-05T18:16:24.419956Z | Download | fc9528ce218dd533ae16d3a88639c78340c48e75c9f2447da5da274a22971163 |
| 0.0.5 | 2022-11-05T19:34:10.727371Z | Download | 74582743f4ec2fc68f38b2735ad717b60b21174b74844e31f16e6a2d92e75740 |
| 1.0.0 | 2022-11-18T22:24:05.916535Z | Download | 7863ea5fabc35e7c7e7a5642f47cbaed5792a13d12df3116b8c0cb963272362f |
| 1.0.0+1 | 2023-01-20T19:00:35.449488Z | Download | 009c332173f63116bddd99d302ff819116f641c439054ed78aed971e9b8b64a2 |
| 1.0.1 | 2023-02-02T17:10:56.425393Z | Download | 5d9010c4a292766c55395b2288532579a85673f8148460d1e233d98ffe10d24e |
| 1.1.0 | 2023-02-22T06:14:49.251972Z | Download | 3190cc26d9ebda686bafb9721bb6a74c6d358700f4fc978a0f2cba6912daff86 |
| 1.1.1 | 2023-03-04T02:38:02.233096Z | Download | 9e8066d2f18e88f2fb1cf6c8ca567417bdfb0145ac28519dcca3c15d42a10b3e |
| 1.1.2 | 2023-03-07T17:07:53.182158Z | Download | 464d3e46ee701c590bfc7b91a698adda71a73b297cd1566c15ca333e5f38db06 |
| 1.1.3 | 2023-03-09T03:05:58.508793Z | Download | 524c9889a1327401124fe068840a8867f0d57987c1219a2a696ade629ec2bec3 |
| 1.1.4 | 2023-03-14T19:07:16.427664Z | Download | 0bf61ad56e6fd6688a2865d3ceaea396bc6a0a90ea0d7ad5049b1b76c09d6163 |
| 1.1.5 | 2023-04-11T16:22:42.616716Z | Download | 15edc42f7eaa478ce854eaf1fbb9062a899c0e4e56e775dd73b7f4709c97c4ca |
| 1.1.5+1 | 2023-04-24T17:58:04.921124Z | Download | 6ca1298b70edcc3486fdb14032f1a186a593f1b5f6b5e82fb10febddcb1c61bb |
| 1.1.6 | 2023-05-18T17:36:35.368108Z | Download | 7430f5d834d0db4560d7b19863362cd892f1e52b43838553a3c5cdfc9ab28e5b |
| 1.1.7 | 2023-06-12T17:21:59.782929Z | Download | 80a13c613c8bde758b1464a1755a7b3a8f2b6cec61fbf0f5a53c94c30f03ba2e |
| 1.1.9 | 2023-10-12T03:16:37.547649Z | Download | d26c0e2f237476426523eb25512e4c09fa27c6d33ed659a0e69d79e20b5dc47f |
| 1.1.9+1 | 2023-10-24T23:00:01.739492Z | Download | d24333727332d9bd20990f1483af4e09abdb9b1fc7c3db940b56ab5c42790c26 |
| 1.1.9+2 | 2024-01-08T18:00:26.649009Z | Download | 03012b0a33775c5530576b70240308080e1d5050f0faf000118c20e6463bc0ad |
| 1.1.10 | 2024-02-05T18:29:21.589911Z | Download | 23c2716416871a7ac70c2860d68d98aac5f9c3b0a079add9c7324f0518999005 |
| 1.1.10+1 | 2024-02-06T19:34:56.797313Z | Download | 18489bdd8850de3dd7ca8a34e0c446f719ec63e2bab2e7a8cc66a9028dd76c5a |
| 1.1.11 | 2024-02-20T16:47:51.660612Z | Download | afff56296ac71ce5779449ef33e5c0274bfda8c219de2095b0a4bca0330ba0fe |
| 1.1.11+1 | 2024-02-20T18:13:21.365376Z | Download | 12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81 |
| 1.1.12 | 2024-10-31T23:26:14.798531Z | Download | f3b9b6e4591c11394d4be4806c63e72d3a41778547b2c1e2a8a04fadcfd7d173 |
| 1.1.13 | 2024-11-05T16:16:28.490482Z | Download | 101e1a04b7474acdf58b463e5df78c8a51401581c2f7dfdaf27376d1aa3b92c6 |
| 1.1.14 | 2024-11-05T17:57:51.811145Z | Download | 26d520739b7c6b5d2a2b3274427874a8390831fd4cd5bb8cfbd7d913477d3a2e |
| 1.1.15 | 2024-11-08T18:52:43.748141Z | Download | ab9ff38fc771e9ee1139320adbe3d18a60327370c218c60752068ebee4b49ab1 |
| 1.1.16 | 2024-11-25T15:54:47.796524Z | Download | 1b4b9e706a10294258727674a340ae0d6e64a7231980f9f9a3d12e4b42407aad |
| 1.1.17 | 2025-05-23T12:44:32.203372Z | Download | 557a315b7d2a6dbb0aaaff84d857967ce6bdc96a63dc6ee2a57ce5a6ee5d3331 |
| 1.1.18 | 2025-08-15T14:00:20.067077Z | Download | ca81fdfaf62a5ab45d7296614aea108d2c7d0efca8393e96174bf4d51e6725b0 |
| 1.1.19 | 2025-08-25T21:06:52.804329Z | Download | d354a7ec6931e6047785f4db12a1f61ec3d43b207fc0790f863818543f8ff0dc |
| 1.1.20 | 2026-01-21T15:40:57.907620Z | Download | 201e876b5d52753626af64b6359cd13ac6011b80728731428fd34bc840f71c9b |
| 1.2.0 | 2026-02-18T22:33:44.664280Z | Download | 5a88dd14c0954a5398af544651c7fb51b457a2a556949bfb25369b210ef73a74 |
| 1.2.1 | 2026-05-06T17:45:13.548989Z | Download | 06f0c50f88a1a020f95138dcc14ef4d5a039ced3f89b386209e6763dfa2cefa0 |
| 1.2.2 | 2026-05-11T16:58:17.065222Z | Download | 98e7e94de127b46a86ef46197fff84ff99f3d3b80a708390d717ad731efef598 |
| 1.2.3 | 2026-05-18T23:17:23.299670Z | Download | b9b3f391857781aa96acacef96066f2f49b4cd03cf9fce3ca4d8da2ef5ea129e |
| 1.2.4 | 2026-05-28T23:02:14.040313Z | Download | 09854c7633b215e6f7bb2a9adb607bc525bae8655c7fc29db880c33e62f72230 |
| 1.2.5 | 2026-05-29T18:17:30.861485Z | Download | 7ee12e6dffe0fc8e755179d6d91b3b34f5924223fc104d85572ef9180d73d172 |
| 1.2.6 | 2026-06-17T17:36:56.891039Z | Download | 142a9146f447d15b10bdc00e21d5f4d83e5b32bb5f8f8f5a04c75311344923a3 |
| 1.3.0 | 2026-07-28T16:56:04.711722Z | Download | 4dca4feb77dc3ec7f6e27e49c53241eb8217f55e4f9b12599a27f8903bca5682 |
| 1.3.1 | 2026-10-12T20:09:47.831777Z | Download | 670a59098f5c4c9f8eab25edba4f72e1bc8172b428b012339ac892eb31c68f2b |
| 1.3.2 | 2026-10-15T20:35:08.825346Z | Download | a8e2c19796144da2f81bcc96dad1bb19c4677b561c452081b97ee737b9faed65 |
| 1.3.3 | 2026-10-27T02:55:53.081423Z | Download | 40c92d6de05024a337a6f25feff931e1480c76cb0bb35fc37553c48951526b2f |
| 1.3.4 | 2026-10-29T15:57:49.091961Z | Download | 4c9d2e7121eea8b4f160e6e435900a0ae7214cfc97c2d6cf84c25532b789b50d |
Dependencies
args "^2.3.0"
meta "^1.7.0"
path "^1.8.0"
path_parsing "^1.0.1"
vector_graphics_codec "^1.1.11+1"
xml "\u003e=6.3.0 \u003c=7.0.1"