ForcePressGestureRecognizer constructor Null safety

  1. {double startPressure = 0.4,
  2. double peakPressure = 0.85,
  3. GestureForceInterpolation interpolation = _inverseLerp,
  4. Object? debugOwner,
  5. @Deprecated('Migrate to supportedDevices. ' 'This feature was deprecated after v2.3.0-1.0.pre.') PointerDeviceKind? kind,
  6. Set<PointerDeviceKind>? supportedDevices}

Creates a force press gesture recognizer.

The startPressure defaults to 0.4, and peakPressure defaults to 0.85 where a value of 0.0 is no pressure and a value of 1.0 is maximum pressure.

The startPressure, peakPressure and interpolation arguments must not be null. The peakPressure argument must be greater than startPressure. The interpolation callback must always return a value in the range 0.0 to 1.0 for values of pressure that are between pressureMin and pressureMax.

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.


  this.startPressure = 0.4,
  this.peakPressure = 0.85,
  this.interpolation = _inverseLerp,
  Object? debugOwner,
    'Migrate to supportedDevices. '
    'This feature was deprecated after v2.3.0-1.0.pre.',
  PointerDeviceKind? kind,
  Set<PointerDeviceKind>? supportedDevices,
}) : assert(startPressure != null),
     assert(peakPressure != null),
     assert(interpolation != null),
     assert(peakPressure > startPressure),
       debugOwner: debugOwner,
       kind: kind,
       supportedDevices: supportedDevices,