throttle method
Implementation
void throttle({String? uniqueKey}) async {
String key = uniqueKey ?? hashCode.toString();
bool enable = _funcThrottle[key] ?? true;
if (enable) {
_funcThrottle[key] = false;
if (timeout == 0) {
try {
await target?.call();
} catch (e) {
rethrow;
} finally {
_funcThrottle.remove(key);
}
} else {
await Future.delayed(Duration(milliseconds: timeout));
_funcThrottle.remove(key);
target?.call();
}
}
}