FollowBehavior constructor

FollowBehavior({
  1. required ReadOnlyPositionProvider target,
  2. PositionProvider? owner,
  3. double maxSpeed = double.infinity,
  4. bool horizontalOnly = false,
  5. bool verticalOnly = false,
  6. int? priority,
  7. ComponentKey? key,
})

Implementation

FollowBehavior({
  required ReadOnlyPositionProvider target,
  PositionProvider? owner,
  double maxSpeed = double.infinity,
  this.horizontalOnly = false,
  this.verticalOnly = false,
  super.priority,
  super.key,
})  : _target = target,
      _owner = owner,
      _speed = maxSpeed,
      assert(maxSpeed > 0, 'maxSpeed must be positive: $maxSpeed'),
      assert(
        !(horizontalOnly && verticalOnly),
        'The behavior cannot be both horizontalOnly and verticalOnly',
      );