forTap method Null safety
- 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:
- 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);
case TargetPlatform.iOS:
case TargetPlatform.linux:
case TargetPlatform.macOS:
case TargetPlatform.windows:
return Future<void>.value();
}
}