PathIconData.fromData constructor

PathIconData.fromData(
  1. String data, {
  2. Rect? viewBox,
  3. PathFillType? fillType,
})

Parse the data (as SVG path's d data) and create a path.

If no viewBox is provided, then the bounds of the path are used and the path is translated at origin.

A fillType can be given, else PathFillType.evenOdd.

Implementation

factory PathIconData.fromData(
  String data, {
  Rect? viewBox,
  PathFillType? fillType,
}) {
  final path = parseSvgPathData(data);
  return PathIconData.sanitized(
    path: path,
    viewBox: viewBox,
    fillType: fillType ?? PathFillType.evenOdd,
  );
}