Flutter SVG Icons – flutter_svg, Material Symbols & Best Libraries

How to use SVG icons in Flutter apps. Covers the flutter_svg package, Material Symbols, Iconify, and how to manage icon assets in Flutter projects.

Amit Yadav
Amit Yadav

Flutter doesn’t render SVGs natively — you need the flutter_svg package. Here’s how to add SVG icons, use Material Symbols built into Flutter, and manage icon assets effectively.

Icon options for Flutter

OptionPackageSVG?Approach
Material Iconsbuilt-inNoIcon font
Material Symbolsflutter_svg or fontOptionalFont or SVG
Custom SVGflutter_svgYesAsset files
Iconifyflutter_iconifyYesCDN / network

Option 1: Material Icons (built-in, no package needed)

Flutter ships Material Icons out of the box — the fastest path for standard icons:

// No import needed — Icon is a core Flutter widget
Icon(Icons.home)
Icon(Icons.home, size: 24.0)
Icon(Icons.home, color: Colors.indigo)

// Outlined variant
Icon(Icons.home_outlined)

// Rounded variant
Icon(Icons.home_rounded)
Tip

For most mobile apps, built-in Material Icons are sufficient and require zero setup. Use flutter_svg only when you need custom icons that aren’t in the Material set.

Option 2: flutter_svg package

For custom SVG icons from Lucide, Feather, Phosphor, or your own brand:

Install

# pubspec.yaml
dependencies:
  flutter_svg: ^2.0.10
flutter pub get

Add SVG assets

Download SVGs from AllSVGIcons and place them in an assets folder:

my_app/
  assets/
    icons/
      home.svg
      search.svg
      settings.svg
  lib/
  pubspec.yaml

Register the folder in pubspec.yaml:

flutter:
  assets:
    - assets/icons/

Use SvgPicture.asset

import 'package:flutter_svg/flutter_svg.dart';

// Basic usage
SvgPicture.asset('assets/icons/home.svg')

// With size and color
SvgPicture.asset(
  'assets/icons/home.svg',
  width: 24,
  height: 24,
  colorFilter: const ColorFilter.mode(
    Colors.indigo,
    BlendMode.srcIn,
  ),
)

// In a button
IconButton(
  onPressed: () {},
  icon: SvgPicture.asset(
    'assets/icons/search.svg',
    width: 20,
    height: 20,
    colorFilter: ColorFilter.mode(
      Theme.of(context).colorScheme.onSurface,
      BlendMode.srcIn,
    ),
  ),
)

Option 3: Network SVG (Iconify CDN)

If you don’t want to bundle SVG files as assets:

// Load from Iconify CDN
SvgPicture.network(
  'https://api.iconify.design/lucide:home.svg',
  width: 24,
  height: 24,
)
Warning

Network SVGs add latency and a network dependency. Bundle SVGs as assets for production apps. Use the network approach only for prototyping or rarely-shown icons.

SVG color in Flutter

Unlike web SVGs, currentColor doesn’t work in Flutter. You must set color explicitly via colorFilter:

// Correct: use ColorFilter.mode with BlendMode.srcIn
SvgPicture.asset(
  'assets/icons/star.svg',
  colorFilter: const ColorFilter.mode(Colors.amber, BlendMode.srcIn),
)

// Dynamically use theme color
SvgPicture.asset(
  'assets/icons/heart.svg',
  colorFilter: ColorFilter.mode(
    Theme.of(context).colorScheme.primary,
    BlendMode.srcIn,
  ),
)

Reusable icon widget

Create a wrapper widget so you can change behavior later without touching all usages:

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

class AppIcon extends StatelessWidget {
  const AppIcon({
    super.key,
    required this.assetPath,
    this.size = 24.0,
    this.color,
  });

  final String assetPath;
  final double size;
  final Color? color;

  @override
  Widget build(BuildContext context) {
    final iconColor = color ?? Theme.of(context).colorScheme.onSurface;
    return SvgPicture.asset(
      assetPath,
      width: size,
      height: size,
      colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn),
    );
  }
}

// Usage
AppIcon(assetPath: 'assets/icons/home.svg')
AppIcon(assetPath: 'assets/icons/home.svg', size: 32, color: Colors.indigo)

Preparing SVGs for Flutter

Before adding SVGs to a Flutter project, optimize them:

  1. Remove width/height attributes from the root <svg> — Flutter uses the width/height params of SvgPicture instead
  2. Flatten groups where possible — simpler SVGs render faster
  3. Keep viewBox — required for correct rendering
  4. Remove currentColor — Flutter ignores it. Use a solid fill or stroke, then override via colorFilter

Online: use AllSVGIcons’ built-in SVG optimizer, or svgo locally:

npx svgo --input icons/ --output icons-optimized/ --config '{"plugins":["removeViewBox"]}'

Frequently asked questions

No. Flutter does not support SVG rendering out of the box. You need the flutter_svg package (pub.dev) to render SVG assets. Alternatively, use Flutter's built-in Icon widget with Material Icons, which requires no extra package.

flutter_svg is the standard package with 4,000+ pub.dev likes. For version 2.x, colorFilter replaces the deprecated color parameter. It supports asset, network, and string SVG sources.

Use the colorFilter property: SvgPicture.asset('icon.svg', colorFilter: const ColorFilter.mode(Colors.blue, BlendMode.srcIn)). The old color param is deprecated in flutter_svg 2.x.

Place SVG files in an assets/icons/ folder, register the folder under flutter.assets in pubspec.yaml, run flutter pub get, then use SvgPicture.asset('assets/icons/name.svg').

Any SVG-based icon library works with flutter_svg: Lucide, Feather, Phosphor, Remix Icons. Download individual SVGs from AllSVGIcons, place them in your assets folder, and render with SvgPicture.asset.
Share this post