I use Firestore for my Flutter app.
When I disable internet connection on emulator, this error appears on the console:
V/NativeCrypto( 6278): Read error: ssl=0xa4621708: I/O error during system call, Software caused connection abort
W/zzaeo ( 6278): [{0}] Failed to resolve name. status={1}
V/NativeCrypto( 6278): Write error: ssl=0xa4621708: I/O error during system call, Broken pipe
V/NativeCrypto( 6278): Write error: ssl=0xa4621708: I/O error during system call, Broken pipe
W/zzajf ( 6278): Failed closing connection
W/zzajf ( 6278): javax.net.ssl.SSLException: Write error: ssl=0xa4621708: I/O error during system call, Broken pipe
W/zzajf ( 6278): at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_write(Native Method)
W/zzajf ( 6278): at com.google.android.gms.org.conscrypt.SslWrapper.write(:com.google.android.gms@[email protected] (040700-192802242):2)
W/zzajf ( 6278): at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket$SSLOutputStream.write(:com.google.android.gms@[email protected] (040700-192802242):6)
W/zzajf ( 6278): at com.google.android.gms.internal.firebase-firestore.zzapc.write(Unknown Source:36)
W/zzajf ( 6278): at com.google.android.gms.internal.firebase-firestore.zzaot.write(Unknown Source:46)
W/zzajf ( 6278): at com.google.android.gms.internal.firebase-firestore.zzapf.close(Unknown Source:24)
W/zzajf ( 6278): at com.google.android.gms.internal.firebase-firestore.zzaku.close(Unknown Source:6)
W/zzajf ( 6278): at com.google.android.gms.internal.firebase-firestore.zzaim.run(Unknown Source:14)
W/zzajf ( 6278): at com.google.android.gms.internal.firebase-firestore.zzahi.run(Unknown Source:13)
W/zzajf ( 6278): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W/zzajf ( 6278): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W/zzajf ( 6278): at java.lang.Thread.run(Thread.java:764)
W/zzaeo ( 6278): [{0}] Failed to resolve name. status={1}
W/zzaeo ( 6278): [{0}] Failed to resolve name. status={1}
W/zzaeo ( 6278): [{0}] Failed to resolve name. status={1}
However, the app keeps running as usual after disconnection. I read about similar errors, and people say that it's a normal behavior and the error should be handled only if it is necessary to retry to make a connection.
Is that a normal behavior? Or if not, how should I handle it?
You can perform a network check before calling your function for Firestore to avoid this exception. To check the network connectivity, I'll recommend you to use Connectivity package. Its pretty simple to use and works for both Android and iOS.