Skip to content

Recording the path in a database #10

@yakou32

Description

@yakou32

@masterashu Thank you so much for your package!

I'm using it to convert an SVG to a path, and I am now to store it in a database.

As you know, parsing a Path is not a straightforward process.

My orientation is to convert the Path into a List<PathCommand> which is storable, such as this:

enum PathCommandType {
  close,
  cubicTo,
  lineTo,
  moveTo,
  quadTo,
}

class PathCommand {
  final PathCommandType type;
  final double? x;
  final double? y;
  final double? controlX;
  final double? controlY;
  final double? endX;
  final double? endY;
  final double? control1X;
  final double? control1Y;
  final double? control2X;
  final double? control2Y;

  const PathCommand({
    required this.type,
    this.controlX,
    this.controlY,
    this.endX,
    this.endY,
    this.control1X,
    this.control1Y,
    this.control2X,
    this.control2Y,
    this.x,
    this.y,
  });
}

With this approach, I can re-create a Path from a List<PathCommand>.

But creating it from a Path is much harder.

My best chance would be to output the List<PathCommand> by wrapping the svg_path_parser.

Would you have any recommandations to do so maybe?

Thanks!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions