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 {
|
updateClientState([String? json]) async {
|
||||||
if (isTest) return;
|
if (isTest) return;
|
||||||
var res = await bind.cmGetClientsState();
|
var res = await bind.cmGetClientsState();
|
||||||
|
List<dynamic> clientsJson;
|
||||||
try {
|
try {
|
||||||
final List clientsJson = jsonDecode(res);
|
clientsJson = jsonDecode(res);
|
||||||
_clients.clear();
|
} catch (e) {
|
||||||
tabController.state.value.tabs.clear();
|
debugPrint("Failed to decode clientsJson: '$res', error $e");
|
||||||
for (var clientJson in clientsJson) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_clients.clear();
|
||||||
|
tabController.state.value.tabs.clear();
|
||||||
|
|
||||||
|
for (var clientJson in clientsJson) {
|
||||||
|
try {
|
||||||
final client = Client.fromJson(clientJson);
|
final client = Client.fromJson(clientJson);
|
||||||
_clients.add(client);
|
_clients.add(client);
|
||||||
_addTab(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