In flutter by executing command HttpClient httpClient = HttpClient()
returns this error :
Unsupported operation: Platform._version
There is solution to this problem?
In flutter by executing command HttpClient httpClient = HttpClient()
returns this error :
Unsupported operation: Platform._version
There is solution to this problem?
3
Answers
What package are you using to create the httpClient? Try replacing it with
http: ^1.2.0
, it works great.The second method, you can go from the console to the link to the problematic code and comment it out, this will also help.
If you need a httpClient just:
You’re presumably trying to use the
HttpClient
class fromdart:io
.dart:io
can be used only for the Dart VM, not for the web. If you want something that can be used for both, then usepackage:http
. Note thatpackage:http
is not a drop-in replacement fordart:io'
sHttpClient
, although a lot of people considerpackage:http
to be easier to use.If you require API-compatibility with
dart:io
‘sHttpClient
, trypackage:universal_io
.