main.dart
class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext context) {
return super.createHttpClient(context)
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true; }}
void main() async {
WidgetsFlutterBinding.ensureInitialized();
HttpOverrides.global = new MyHttpOverrides();
runApp(Myapp());}
网友评论