onTap static method

VoidCallback onTap(
  1. VoidCallback onTap, {
  2. int? interval = 500,
  3. bool? releaseFocus = true,
})

Implementation

static VoidCallback onTap(VoidCallback onTap, {int? interval = 500, bool? releaseFocus = true}) => () {
      var millisecondsSinceEpoch = DateTime.now().millisecondsSinceEpoch;
      if ((millisecondsSinceEpoch - _last) > (interval ?? 500)) {
        onTap.call();
        if (releaseFocus == true) {
          FocusManager.instance.primaryFocus?.unfocus();
        }
        _last = millisecondsSinceEpoch;
      }
    };