Made Settings persistent with autosave
This commit is contained in:
10
lib/app.dart
10
lib/app.dart
@ -21,6 +21,7 @@ class App extends StatefulWidget {
|
||||
|
||||
class _AppState extends State<App> {
|
||||
int currentPage = 0;
|
||||
late Timer refetchChats;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -29,7 +30,8 @@ class _AppState extends State<App> {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
Provider.of<ChatListProps>(context, listen: false).run();
|
||||
});
|
||||
Timer.periodic(const Duration(minutes: 1), (timer) {
|
||||
refetchChats = Timer.periodic(const Duration(minutes: 1), (timer) {
|
||||
if(!context.mounted) return;
|
||||
Provider.of<ChatListProps>(context, listen: false).run();
|
||||
});
|
||||
|
||||
@ -101,4 +103,10 @@ class _AppState extends State<App> {
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
refetchChats.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user