How to fix HttpException: Connection closed before full header was received

后端 未结 11 2738
不知归路
不知归路 2020-12-03 02:22

I have recently upgraded my flutter version in my app. But when I want to debug the application, it shows me the following error.

Error connecting to the service prot

11条回答
  •  感情败类
    2020-12-03 02:54

    I figured out how to limit the connections on the underlying HttpClient of NetworkImage!

    I globally overrode the HttpClient: (ref: Override HttpClient globally)

    class MyHttpOverrides extends HttpOverrides {
      @override
      HttpClient createHttpClient(SecurityContext context) {
        return super.createHttpClient(context)
            ..maxConnectionsPerHost = 5;
      }
    }
    
    
    void main() {
      HttpOverrides.global = MyHttpOverrides();
      runApp(MyApp());
    }
    

    Ref : Connection closed...

提交回复
热议问题