From c237f0243032c659fcda57e1e104d0559f51be75 Mon Sep 17 00:00:00 2001 From: fuwa Date: Tue, 23 Jul 2019 07:01:30 +0800 Subject: [PATCH] use syncState --- cyberwow/lib/state.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cyberwow/lib/state.dart b/cyberwow/lib/state.dart index f91f088..6359c9c 100644 --- a/cyberwow/lib/state.dart +++ b/cyberwow/lib/state.dart @@ -70,6 +70,9 @@ class HookedState extends AppState { final SetStateFunc setState; final GetNotificationFunc getNotification; HookedState(this.setState, this.getNotification); + syncState() { + setState(this); + } } class BlankState extends HookedState { @@ -91,7 +94,7 @@ class LoadingState extends HookedState { void append(String msg) { this.status += msg; - setState(this); + syncState(); } @@ -141,7 +144,7 @@ class SyncingState extends HookedState { void append(String msg) { this.stdout += msg; - setState(this); + syncState(); } Future next(Stream processOutput) async { @@ -218,7 +221,7 @@ class SyncedState extends HookedState { // print('synced loop'); height = await rpc.height(); connected = await daemon.isConnected(); - setState(this); + syncState(); } } @@ -242,7 +245,7 @@ class ReSyncingState extends HookedState { void append(String msg) { this.stdout += msg; - setState(this); + syncState(); } Future next() async {