Skip to main content
gavinatkinson
April 21, 2023
Question

Rest API: exposing SVG real strokes

  • April 21, 2023
  • 12 replies
  • 1546 views

It would be extremely useful to have raw SVG paths exposed for the PATH object type. Not the path outlines, just the d attribute of the path. Not having this has make the api essentially unworkable for certain things, like when the absolute smallest SVG possible is required.

The only way to programmatically get the real path commands for a PATH type object is to go through the image rest api, retrieve the svg and parse it to get the d attribute.

This topic has been closed for replies.

12 replies

July 22, 2024

@BostonUX it seems you implemented the logic of converting geometry outlines to original points. Could you please share your code no matter the language?

Thank you,

BostonUX
July 23, 2024

Hello @sneko in our plugin Figma2Flutter we are not converting to actual stroke path from the path outlines we get from Figma’s API.

Instead we used the approach I described in my lengthy post above and are clipping the “stroke shapes” we get from Figma’s API to get the correct shape for “CENTER”, “INSIDE” and “OUTSIDE”.

You can try using the plugin to export from Figma file and then inspect the generated Dart code (code is in the GIT repository of the package which you get when exporting).