fix empty peers

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
This commit is contained in:
Sahil Yeole 2023-10-23 04:03:05 +05:30
parent dad209d1cd
commit 935297b9e8

View File

@ -54,6 +54,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
} }
} }
bool isPeersLoading = false; bool isPeersLoading = false;
bool isPeersLoaded = false;
@override @override
void initState() { void initState() {
@ -136,6 +137,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
await _getAllPeers(); await _getAllPeers();
setState(() { setState(() {
isPeersLoading = false; isPeersLoading = false;
isPeersLoaded = true;
}); });
} }
@ -208,7 +210,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
if (textEditingValue.text == '') { if (textEditingValue.text == '') {
return const Iterable<Peer>.empty(); return const Iterable<Peer>.empty();
} }
else if (peers.isEmpty) { else if (peers.isEmpty && !isPeersLoaded) {
Peer emptyPeer = Peer( Peer emptyPeer = Peer(
id: '', id: '',
username: '', username: '',