LongPressGestureRecognizer constructor Null safety

LongPressGestureRecognizer(
  1. {Duration? duration,
  2. double? postAcceptSlopTolerance = null,
  3. @Deprecated('Migrate to supportedDevices. ' 'This feature was deprecated after v2.3.0-1.0.pre.') PointerDeviceKind? kind,
  4. Set<PointerDeviceKind>? supportedDevices,
  5. Object? debugOwner}
)

Creates a long-press gesture recognizer.

Consider assigning the onLongPressStart callback after creating this object.

The postAcceptSlopTolerance argument can be used to specify a maximum allowed distance for the gesture to deviate from the starting point once the long press has triggered. If the gesture deviates past that point, subsequent callbacks (onLongPressMoveUpdate, onLongPressUp, onLongPressEnd) will stop. Defaults to null, which means the gesture can be moved without limit once the long press is accepted.

The duration argument can be used to overwrite the default duration after which the long press will be recognized.

It's possible to limit this recognizer to a specific set of PointerDeviceKinds by providing the optional supportedDevices argument. If supportedDevices is null, the recognizer will accept pointer events from all device kinds.

Implementation

LongPressGestureRecognizer({
  Duration? duration,
  // TODO(goderbauer): remove ignore when https://github.com/dart-lang/linter/issues/3349 is fixed.
  // ignore: avoid_init_to_null
  super.postAcceptSlopTolerance = null,
  @Deprecated(
    'Migrate to supportedDevices. '
    'This feature was deprecated after v2.3.0-1.0.pre.',
  )
  super.kind,
  super.supportedDevices,
  super.debugOwner,
}) : super(
       deadline: duration ?? kLongPressTimeout,
     );