I have been working with Firestore and am successful in implementing it. However, when I test it offline, aiming to implement a respective UI display that there is no access to the server at that time or anything, I keep getting a the client is offline error and for some reason, there's no way for me to catch it.
Here's the error message:
Exception has occurred.
PlatformException (PlatformException(Error performing get, Failed to get document because the client is offline., null))
Here's also my sample code:
DocumentReference ref = firestoreDb.collection('collection').document('doc1');
try{
ref.get().then((DocumentSnapshot ds){
if(ds.exists == true){
print('ds exists');
}else{
print('ds does not exist);
}
}).catchError((err){
print(err);
});
} on PlatformException catch (err){
print(err);
} catch (err){
print(err);
}
Any of the error catches in the sample code we're bypassed and the error is not actually caught. I need to atleast catch the client is offline exception so I can properly update my UI.