make getAllPeers async

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
This commit is contained in:
Sahil Yeole 2023-10-16 23:36:43 +05:30
parent 4a42e3ef1b
commit 26982787ee

View File

@ -152,13 +152,13 @@ class _ConnectionPageState extends State<ConnectionPage>
connect(context, id, isFileTransfer: isFileTransfer); connect(context, id, isFileTransfer: isFileTransfer);
} }
void getAllPeers(){ Future<void> getAllPeers() async {
peers.clear(); peers.clear();
Map<String, dynamic> recentPeers = jsonDecode(bind.mainLoadRecentPeersSync()); Map<String, dynamic> recentPeers = jsonDecode(await bind.mainLoadRecentPeersSync());
Map<String, dynamic> favPeers = jsonDecode(bind.mainLoadFavPeersSync()); Map<String, dynamic> favPeers = jsonDecode(await bind.mainLoadFavPeersSync());
Map<String, dynamic> lanPeers = jsonDecode(bind.mainLoadLanPeersSync()); Map<String, dynamic> lanPeers = jsonDecode(await bind.mainLoadLanPeersSync());
Map<String, dynamic> abPeers = jsonDecode(bind.mainLoadAbSync()); Map<String, dynamic> abPeers = jsonDecode(await bind.mainLoadAbSync());
Map<String, dynamic> groupPeers = jsonDecode(bind.mainLoadGroupSync()); Map<String, dynamic> groupPeers = jsonDecode(await bind.mainLoadGroupSync());
Map<String, dynamic> combinedPeers = {}; Map<String, dynamic> combinedPeers = {};
@ -170,7 +170,7 @@ class _ConnectionPageState extends State<ConnectionPage>
try { try {
peerData = jsonDecode(peerData); peerData = jsonDecode(peerData);
} catch (e) { } catch (e) {
print("Error decoding peers: $e"); debugPrint("Error decoding peers: $e");
return; return;
} }
} }