Fix connection info

This commit is contained in:
problematicconsumer
2024-02-13 16:59:35 +03:30
parent eee31da912
commit 28ece8fb2e
5 changed files with 105 additions and 136 deletions

View File

@@ -0,0 +1,16 @@
import 'package:flutter/foundation.dart';
class Throttler {
Throttler(this.throttleFor);
final Duration throttleFor;
DateTime? _lastCall;
void call(VoidCallback callback) {
if (_lastCall == null ||
DateTime.now().difference(_lastCall!) > throttleFor) {
callback();
_lastCall = DateTime.now();
}
}
}