simple changes
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
f7c1b8d88f
commit
e143493d7b
@ -410,18 +410,25 @@ class ServerModel with ChangeNotifier {
|
||||
updateClientState([String? json]) async {
|
||||
if (isTest) return;
|
||||
var res = await bind.cmGetClientsState();
|
||||
List<dynamic> clientsJson;
|
||||
try {
|
||||
final List clientsJson = jsonDecode(res);
|
||||
_clients.clear();
|
||||
tabController.state.value.tabs.clear();
|
||||
for (var clientJson in clientsJson) {
|
||||
clientsJson = jsonDecode(res);
|
||||
} catch (e) {
|
||||
debugPrint("Failed to decode clientsJson: '$res', error $e");
|
||||
return;
|
||||
}
|
||||
|
||||
_clients.clear();
|
||||
tabController.state.value.tabs.clear();
|
||||
|
||||
for (var clientJson in clientsJson) {
|
||||
try {
|
||||
final client = Client.fromJson(clientJson);
|
||||
_clients.add(client);
|
||||
_addTab(client);
|
||||
} catch (e) {
|
||||
debugPrint("Failed to decode clientJson '$clientJson', error $e");
|
||||
}
|
||||
notifyListeners();
|
||||
} catch (e) {
|
||||
debugPrint("Failed to updateClientState:$e");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user