path_parsing 0.1.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 73

path_parsing

Split from the Flutter path drawing library to create a pure Dart parsing library for SVG paths and code generation (without dependencies on Flutter runtime).

CHANGELOG

0.1.3

  • Fix a bug in decompose cubic curve - avoid trying to call toInt() on double.infinity
  • Bump test dependency.

0.1.2

  • Fix bug with smooth curve commands
  • Add deep testing

0.1.1

  • Fix link to homepage in pubspec, add example

0.1.0

  • Initial release, based on the 0.2.4 release of path_drawing

example/main.dart

import 'package:path_parsing/path_parsing.dart';

/// A [PathProxy] that dumps Flutter `Path` commands to the console.
class PathPrinter extends PathProxy {
  @override
  void close() {
    print('Path.close();');
  }

  @override
  void cubicTo(
      double x1, double y1, double x2, double y2, double x3, double y3) {
    print('Path.cubicTo($x1, $y1, $x2, $y2, $x3, $y3);');
  }

  @override
  void lineTo(double x, double y) {
    print('Path.lineTo($x, $y);');
  }

  @override
  void moveTo(double x, double y) {
    print('Path.moveTo($x, $y);');
  }
}

void main() {
  const String pathData =
      'M22.1595 3.80852C19.6789 1.35254 16.3807 -4.80966e-07 12.8727 -4.80966e-07C9.36452 -4.80966e-07 6.06642 1.35254 3.58579 3.80852C1.77297 5.60333 0.53896 7.8599 0.0171889 10.3343C-0.0738999 10.7666 0.206109 11.1901 0.64265 11.2803C1.07908 11.3706 1.50711 11.0934 1.5982 10.661C2.05552 8.49195 3.13775 6.51338 4.72783 4.9391C9.21893 0.492838 16.5262 0.492728 21.0173 4.9391C25.5082 9.38548 25.5082 16.6202 21.0173 21.0667C16.5265 25.5132 9.21893 25.5133 4.72805 21.0669C3.17644 19.5307 2.10538 17.6035 1.63081 15.4937C1.53386 15.0627 1.10252 14.7908 0.66697 14.887C0.231645 14.983 -0.0427272 15.4103 0.0542205 15.8413C0.595668 18.2481 1.81686 20.4461 3.5859 22.1976C6.14623 24.7325 9.50955 26 12.8727 26C16.236 26 19.5991 24.7326 22.1595 22.1976C27.2802 17.1277 27.2802 8.87841 22.1595 3.80852Z';

  writeSvgPathDataToPath(pathData, new PathPrinter());
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  path_parsing: ^0.1.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:path_parsing/path_parsing.dart';
  
Version Uploaded Documentation Archive
0.1.3 Oct 25, 2018 Go to the documentation of path_parsing 0.1.3 Download path_parsing 0.1.3 archive
0.1.2 Aug 2, 2018 Go to the documentation of path_parsing 0.1.2 Download path_parsing 0.1.2 archive
0.1.1 Jul 30, 2018 Go to the documentation of path_parsing 0.1.1 Download path_parsing 0.1.1 archive
0.1.0 Jul 30, 2018 Go to the documentation of path_parsing 0.1.0 Download path_parsing 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
52
Health:
Code health derived from static analysis. [more]
91
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:path_parsing/path_parsing.dart.

Health issues and suggestions

Document public APIs (-9.32 points)

41 out of 44 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Format lib/src/path_parsing.dart.

Run dartfmt to format lib/src/path_parsing.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
meta >=1.1.2 <2.0.0 1.1.6
vector_math >=2.0.6 <3.0.0 2.0.8
Dev dependencies
path ^1.5.1
test ^1.3.4