connection failed while calling api in flutter

Advertisements I am connecting api using swagger it is giving excelent result but when hitting api via mobile app it throws error connection failed: OS Error: Network is unreachable errorno= 101 my api calling code var file = await File(filepath).readAsBytes(); var uri = Uri.parse(‘http://192.168.18.2:1111/predict’); // print(url); // Create a multipart request var request = http.MultipartRequest("POST",… Read More connection failed while calling api in flutter

I have an error while parsing json data over internet in flutter

Advertisements This is my code and i am having an error in the "builder": while opening the curly braces it shows error like The body might complete normally, causing ‘null’ to be returned, but the return type, ‘Widget’, is a potentially non-nullable type. Try adding either a return or a throw statement at the end.… Read More I have an error while parsing json data over internet in flutter

http server that counts requests

Advertisements I am learning to use python to run an HTTP server and wanted to make a server that would count every time I refresh. I tried this: from http.server import HTTPServer, BaseHTTPRequestHandler count = 0 class HelloWorldRequestHandler(BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.end_headers() count = count + 1 self.wfile.write(str.encode(count)) httpd = HTTPServer(("localhost",8000),HelloWorldRequestHandler) httpd.serve_forever() but I get… Read More http server that counts requests

Are HTTP 1.1 methods like PUT, DELETE, etc. were added explicitly to support REST?

Advertisements It is often said that you should use PUT, DELETE, and other methods of HTTP 1.1 to provide a RESTful API. The purpose is to make URI to reference a resource (representation) and the method designate the action to be done. I see that HTTP 1.1 was released in 1997 and Fielding’s PhD paper… Read More Are HTTP 1.1 methods like PUT, DELETE, etc. were added explicitly to support REST?

Fetch cannot change content type to application/json

Advertisements My http request got 415 error and checked why, I set it’s content type to json but it’s not applying. let data = { id: category.id, act: "addAdmin", target: input, }; fetch("http://localhost:8888/categoryset", { method: "POST", header: { "Content-Type": "application/json", }, body: JSON.stringify(data), }); and this is Request Headers as result.. POST /categoryset HTTP/1.1 Accept:… Read More Fetch cannot change content type to application/json

type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String' using http package

Advertisements I am trying to fetch data from a link. Here is the link: – "https://wrestlingworld.co/wp-json/wp/v2/posts?categories=22&quot; While fetching I get the error. I tried some various ways to do it but can’t find the accurate solution. I am attaching my code, What I tried what I did to solve the issue. Here is my controller:… Read More type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String' using http package