forTap method
Provides platform-specific feedback for a tap.
On Android the click system sound is played. On iOS this is a no-op.
See also:
- wrapForTap to trigger platform-specific feedback before executing a GestureTapCallback.
Implementation
static Future<void> forTap(BuildContext context) async {
context.findRenderObject().sendSemanticsEvent(const TapSemanticEvent());
switch (_platform(context)) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
return SystemSound.play(SystemSoundType.click);
default:
return Future<void>.value();
}
}