If you are using a string URI when dealing with the http package in Flutter, you may be seeing this error:
The argument type 'String' can't be assigned to the parameter type 'Uri' at .... (argument_type_not_assignable)
This error is due to an update in the package.
Parse the String to be an explicit URI by using the
Here is it in an example:
String dataURL = "https://api.com/users"; http.Response response = await http.get(Uri.parse(dataURL));
To improve compile-time type safety, the http package (version 0.13.0) introduced changes that made all functions that previously accepted
Strings now accept only
You will need to explicitly use
Uri.parse to convert
Uris. In the previous version, the http packaged called that for you behind the scenes.