cache tab deletets for faster ui rebuild

This commit is contained in:
Fabian Freund
2025-10-13 12:33:16 +02:00
parent 8cf3794525
commit a536fe30da
6 changed files with 101 additions and 3 deletions
@@ -0,0 +1,23 @@
import 'dart:async';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'tab_delete_cache.g.dart';
@Riverpod(keepAlive: true)
class TabDeleteCache extends _$TabDeleteCache {
void delete(String tabId) {
state = {...state, tabId};
Timer(const Duration(seconds: 3), () {
if (ref.mounted) {
state = {...state}..remove(tabId);
}
});
}
@override
Set<String> build() {
return {};
}
}