combine method Null safety

Path combine (
  1. PathOperation operation,
  2. Path path1,
  3. Path path2

Combines the two paths according to the manner specified by the given operation.

The resulting path will be constructed from non-overlapping contours. The curve order is reduced where possible so that cubics may be turned into quadratics, and quadratics maybe turned into lines.


static Path combine(PathOperation operation, Path path1, Path path2) {
  assert(path1 != null); // ignore: unnecessary_null_comparison
  assert(path2 != null); // ignore: unnecessary_null_comparison
  final Path path = Path();
  if (path._op(path1, path2, operation.index)) {
    return path;
  throw StateError('Path.combine() failed.  This may be due an invalid path; in particular, check for NaN values.');