wrapForTap method Null safety

GestureTapCallback? wrapForTap(
  1. GestureTapCallback? callback,
  2. BuildContext context
)

Wraps a GestureTapCallback to provide platform specific feedback for a tap before the provided callback is executed.

On Android the platform-typical click system sound is played. On iOS this is a no-op as that platform usually doesn't provide feedback for a tap.

See also:

Implementation

static GestureTapCallback? wrapForTap(GestureTapCallback? callback, BuildContext context) {
  if (callback == null) {
    return null;
  }
  return () {
    Feedback.forTap(context);
    callback();
  };
}