FollowBehavior constructor
FollowBehavior({
- required ReadOnlyPositionProvider target,
- PositionProvider? owner,
- double maxSpeed = double.infinity,
- bool horizontalOnly = false,
- bool verticalOnly = false,
- int? priority,
- 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',
);