forTap static method

Future<void> forTap(
  1. BuildContext context
)

Provides platform-specific feedback for a tap.

On Android the click system sound is played. On iOS this is a no-op.

See also:

Implementation

static Future<void> forTap(BuildContext context) async {
  context.findRenderObject()!.sendSemanticsEvent(const TapSemanticEvent());
  switch (defaultTargetPlatform) {
    case TargetPlatform.android:
    case TargetPlatform.fuchsia:
      return SystemSound.play(SystemSoundType.click);
    case TargetPlatform.iOS:
    case TargetPlatform.linux:
    case TargetPlatform.macOS:
    case TargetPlatform.windows:
      return Future<void>.value();
  }
}