I want to send a request to my machine using an ip address... Please take this unnecessary exception out so I can send a request. Thanks.
This is not an unnecessary exception.
The exception specifically calls out 'scheme' being "non-alphabetic", which is true if you're trying to connect to a raw IP "URI" like '8.8.8.8'.
You can read more about the syntax of URIs, but the point is a valid URI requires at least a scheme and a path. An IP is a path, meaning you're missing a scheme, like 'http'.
What you likely need to do is change your URI to something like 'http://8.8.8.8/example.file'.
Here's an example of something I've verified works:
import 'package:http/http.dart' as http;
main() {
http.read("http://127.0.0.1:8000/").then(print);
}
Thanks for this Issue. I have actually wondered about this when I made the same stupid mistake.
Most helpful comment
This is not an unnecessary exception.
The exception specifically calls out 'scheme' being "non-alphabetic", which is true if you're trying to connect to a raw IP "URI" like '8.8.8.8'.
You can read more about the syntax of URIs, but the point is a valid URI requires at least a
schemeand apath. An IP is apath, meaning you're missing a scheme, like 'http'.What you likely need to do is change your URI to something like 'http://8.8.8.8/example.file'.
Here's an example of something I've verified works: