MoveAlongPathEffect constructor

MoveAlongPathEffect(
  1. Path path,
  2. EffectController controller, {
  3. bool absolute = false,
  4. bool oriented = false,
  5. PositionProvider? target,
  6. void onComplete()?,
  7. ComponentKey? key,
})

Implementation

MoveAlongPathEffect(
  Path path,
  EffectController controller, {
  bool absolute = false,
  bool oriented = false,
  PositionProvider? target,
  void Function()? onComplete,
  super.key,
})  : _isAbsolute = absolute,
      _followDirection = oriented,
      super(
        controller,
        target,
        onComplete: onComplete,
      ) {
  final metrics = path.computeMetrics().toList();
  if (metrics.length != 1) {
    throw ArgumentError(
      'Only single-contour paths are allowed in MoveAlongPathEffect',
    );
  }
  _pathMetric = metrics[0];
  _pathLength = _pathMetric.length;
  assert(_pathLength > 0);
}