Search code examples
flutterhttphttpclienturihost

(Flutter) HTTPClient Invalid argument(s): No host specified in URI


Currently working on a little app that allows users to view a database stored on Heroku, however I am running into the aforementioned issue when using the database's URL: ".herokuapp.com/api/".

var client = createHttpClient();
var response = await client.read('<example>.herokuapp.com/api/<data>');
List data = JSON.decode(response);

Heroku doesn't seem to use HTTP(S) nor www, the latter of which I believe to be the issue.

Does anyone know how I can bypass or resolve this issue?


Solution

  • I know this is an old problem but I just stumbled into this problem and fixed it by adding an "http://" before the URL.