Reputation: 2896
class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(context)
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
}
}
HttpOverrides.global = MyHttpOverrides();
Many answers have answered as above and I have tried many times
I have 2 Android devices and 2 iPhone devices, and actually 1 devices are in use. (I use them they don`t need Wifi)
Unhandled Exception: HandshakeException: Connection terminated during handshake
It seems to have something to do with wifi.
Upvotes: 0
Views: 388
Reputation: 1
In your main.dart file, add or import the following class:
HttpOverrides.global = MyHttpOverrides();
After adding the main.dat looks like:
void main() { // some code HttpOverrides.global = MyHttpOverrides(); runApp(const ConsultationApp()); }
Upvotes: 0
Reputation: 3552
Did you forget to set your HttpOverrides? In your main set it like this:
HttpOverrides.global = MyHttpOverrides();
Upvotes: 0