Readded binding observer
This commit is contained in:
parent
d5344494d7
commit
4433f1ba44
@ -31,7 +31,7 @@ class App extends StatefulWidget {
|
|||||||
State<App> createState() => _AppState();
|
State<App> createState() => _AppState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AppState extends State<App> {
|
class _AppState extends State<App> with WidgetsBindingObserver {
|
||||||
late Timer refetchChats;
|
late Timer refetchChats;
|
||||||
late Timer updateTimings;
|
late Timer updateTimings;
|
||||||
|
|
||||||
@ -47,6 +47,7 @@ class _AppState extends State<App> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
WidgetsBinding.instance.addObserver(this);
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
Provider.of<BreakerProps>(context, listen: false).run();
|
Provider.of<BreakerProps>(context, listen: false).run();
|
||||||
Provider.of<ChatListProps>(context, listen: false).run();
|
Provider.of<ChatListProps>(context, listen: false).run();
|
||||||
@ -149,6 +150,7 @@ class _AppState extends State<App> {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
refetchChats.cancel();
|
refetchChats.cancel();
|
||||||
updateTimings.cancel();
|
updateTimings.cancel();
|
||||||
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user