6

Put this code in pubspec.yaml

flutter_svg: ^0.19.3

Even I put in assets these

assets:
     - assets\icons\logo.jpg
     - assets\icons\menuicon.svg
     - assets\icons\searchIcon.svg

In code it looks like this

IconButton(
                    icon: Icon(Icons.searchicon.svg),
                    onPressed: () {},
Anar
  • 71
  • 1
  • 1
  • 2
  • Does this answer your question? [Flutter SVG rendering](https://stackoverflow.com/questions/44087400/flutter-svg-rendering) – ibhavikmakwana Apr 21 '21 at 05:37

1 Answers1

11

The Icon parameter accept any kind of widget not only Icon So you can use any widget like below

   IconButton(icon: SvgPicture.asset(
      assetName,
      color: Colors.red,
      semanticsLabel: 'Label'
    ),onPressed: () {},
Nilesh Senta
  • 5,236
  • 2
  • 19
  • 27