svg-to-flutter-path-converter
svg-to-flutter-path-converter copied to clipboard
ReferenceError: width is not defined
Hi
When i run the following command
svg-to-flutter convert Downloads/ic_mail.svg -o path.dart
i get this error
/Users/user1/svg-to-flutter-path-converter/src/convert.js:252
let pathData = getPathData(shapes, width, height);
^
ReferenceError: width is not defined
at shapesToFlutterCodeConverter (/Users/user1/svg-to-flutter-path-converter/src/convert.js:252:38)
at SvgToFlutterPathConverter.convertFromString (/Users/user1/svg-to-flutter-path-converter/src/convert.js:54:12)
at SvgToFlutterPathConverter.convertFromFilePath (/Users/user1/svg-to-flutter-path-converter/src/convert.js:26:17)
at Command.<anonymous> (/Users/user1/svg-to-flutter-path-converter/src/index.js:24:35)
at Command.listener [as _actionHandler] (/Users/user1/svg-to-flutter-path-converter/node_modules/commander/lib/command.js:481:17)
at /Users/user1/svg-to-flutter-path-converter/node_modules/commander/lib/command.js:1237:65
at Command._chainOrCall (/Users/user1/svg-to-flutter-path-converter/node_modules/commander/lib/command.js:1153:12)
at Command._parseCommand (/Users/user1/svg-to-flutter-path-converter/node_modules/commander/lib/command.js:1237:27)
at Command._dispatchSubcommand (/Users/user1/svg-to-flutter-path-converter/node_modules/commander/lib/command.js:1059:25)
at Command._parseCommand (/Users/user1/svg-to-flutter-path-converter/node_modules/commander/lib/command.js:1202:19)
Node.js v18.3.0
i tried with a big svg then thought size might be an issue or file included tags unknown..etc, then i tried with a smaller svg you will find it below
Thanks in advance.
Hi @m7mdra. I fixed it in the latest commit. Can you pull and try again, please? :)
Hey @flutter-clutter, thanks for following up
its working now,
However i tried it with different image with more details, curves, color. it produced the following error.
/Users/user1/svg-to-flutter-path-converter/src/convert.js:223
return (value.match(/\d+/g)).map(function (o) {
^
TypeError: Cannot read properties of null (reading 'map')
at colorStringToObject (/Users/user1/svg-to-flutter-path-converter/src/convert.js:223:32)
at /Users/user1/svg-to-flutter-path-converter/src/convert.js:319:17
at Array.forEach (<anonymous>)
at shapesToFlutterCodeConverter (/Users/user1/svg-to-flutter-path-converter/src/convert.js:254:18)
at SvgToFlutterPathConverter.convertFromString (/Users/user1/svg-to-flutter-path-converter/src/convert.js:54:12)
at SvgToFlutterPathConverter.convertFromFilePath (/Users/user1/svg-to-flutter-path-converter/src/convert.js:26:17)
at Command.<anonymous> (/Users/user1/svg-to-flutter-path-converter/src/index.js:24:35)
at Command.listener [as _actionHandler] (/Users/user1/svg-to-flutter-path-converter/node_modules/commander/lib/command.js:481:17)
at /Users/user1/svg-to-flutter-path-converter/node_modules/commander/lib/command.js:1237:65
at Command._chainOrCall (/Users/user1/svg-to-flutter-path-converter/node_modules/commander/lib/command.js:1153:12)
this is the image used.
Thanks in advance.
hey, facing same error as above
hey, facing same error as above