- To use SVG icons efficiently in the Flutter we need to generate icon data using the FlutterIcons
- As of now FlutterIcons only support the svg file with one tag.
- If your svg file contains more than one tag and other special parameters you may get an error (if image looks not as expected please convert to compound path manually.) while importing the icons to FlutterIcons.
- Now we need to follow some guideline to refine the svg file to generate the icon font file. Guide.
- But when the no of icons is more it will take more time to refine these files manually. So I created a powershell script that uses the inkscape and svgo command line access in windows to automate the process.
- Inspiration:- Stack overflow Answer (But this is for macOs).
-
Install the svgo globally via npm.
npm install -g svgo
-
Download and install the InkScape from the website: https://inkscape.org/
-
Now update the following path in Environment
C:\Program Files\Inkscape\bin (inkscape.exe should be there) C:\Program Files\nodejs C:\Users\<User>\AppData\Roaming\npm
-
If PowerShell restricts script execution, you might need to change the execution policy. To allow script execution, run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser