flutter_svg
2.5.0, released today by flutter.dev
Renders Scalable Vector Graphics (SVG 1.1) and precompiled vector graphics in Flutter.
What it does
flutter_svg parses and displays SVG 1.1 vector graphics directly inside Flutter widget trees from assets, network URLs, strings, or files. It allows tinting, custom color mapping, and manual rendering to a Canvas or ui.Image. It also supports loading precompiled binary vector graphics (.vec) generated by the vector_graphics_compiler for improved runtime performance.
AI-written summary of version 2.3.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- Rendering SVG files from local assets, memory strings, or network endpoints.
- Displaying resolution-independent vector icons and illustrations without raster scaling artifacts.
- Manipulating SVG colors programmatically via color filters or ColorMapper rules.
Skip it when
- Handling raster image formats like PNG, JPEG, or WebP without any SVG requirements.
- Working with complex SVGs requiring full CSS styling or unsupported advanced SVG features.
Strengths
- Supports multiple input sources including asset, network, string, and raw byte loaders.
- Integrates with vector_graphics for ahead-of-time precompilation and faster parsing.
- Provides granular color remapping via the ColorMapper interface and colorFilter properties.
Weaknesses
- CSS support is limited, requiring presentation attributes instead of inline CSS for best compatibility.
- Complex SVG features or improper configurations may fail to render as expected compared to standard web browsers.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
const assetName = 'assets/dart.svg';
final Widget svg = SvgPicture.asset(
assetName,
semanticsLabel: 'Dart Logo',
);Alternatives
Packages that do the same job and could replace flutter_svg.
- extended_image
Pick extended_image when handling raster images requiring zooming, caching, panning, and crop tools rather than vector SVG rendering.
80Compare - octo_image
Pick octo_image when you need advanced placeholder, error, and progress indicator mechanics for raster images.
94Compare
Works with
Packages commonly used together with flutter_svg: ones it builds on, ones built on it, and its own family.
- vector_graphics_compilerflutter_svg depends on itA compiler to convert SVGs to the binary format used by package:vector_graphics.
- vector_graphicsflutter_svg depends on itA vector graphics rendering package for Flutter using a binary encoding.
- vector_graphics_codecflutter_svg depends on itEncoding and decoding library for the vector_graphics binary format
- signatureBuilt on flutter_svgA Flutter plugin providing a performance-optimized signature canvas with custom styling and export.
- flutter_math_forkBuilt on flutter_svgFast and high-quality TeX math equation rendering with pure Dart and Flutter.
- fwfh_svgBuilt on flutter_svgWidgetFactory extension to render SVG inside HTML widgets via flutter_svg.
- gpt_markdownBuilt on flutter_svgPowerful Flutter Markdown and LaTeX renderer built for AI streaming outputs.
- stream_chat_flutterBuilt on flutter_svgFull-featured Flutter UI SDK for Stream Chat, providing ready‑made chat widgets and theming.