mirror of
https://github.com/immich-app/immich.git
synced 2025-08-11 09:16:31 -04:00
* chore: bump dart sdk to 3.8 * chore: make build * make pigeon * chore: format files --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
16 lines
439 B
Dart
16 lines
439 B
Dart
import 'dart:async';
|
|
import 'dart:ui';
|
|
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
|
|
// https://github.com/rrousselGit/flutter_hooks/issues/233#issuecomment-840416638
|
|
void useInterval(Duration delay, VoidCallback callback) {
|
|
final savedCallback = useRef(callback);
|
|
savedCallback.value = callback;
|
|
|
|
useEffect(() {
|
|
final timer = Timer.periodic(delay, (_) => savedCallback.value());
|
|
return timer.cancel;
|
|
}, [delay]);
|
|
}
|