forLongPress method

Future<void> forLongPress (BuildContext context)

Provides platform-specific feedback for a long press.

On Android the platform-typical vibration is triggered. On iOS this is a no-op as that platform usually doesn't provide feedback for long presses.

See also:

Implementation

static Future<void> forLongPress(BuildContext context) {
  context.findRenderObject().sendSemanticsEvent(const LongPressSemanticsEvent());
  switch (_platform(context)) {
    case TargetPlatform.android:
    case TargetPlatform.fuchsia:
      return HapticFeedback.vibrate();
    default:
      return Future<void>.value();
  }
}