Weird one for you today…
var url = Uri.parse(myRedactedUrl);
try {
http.Response response = await http.get(url).timeout(const Duration(seconds: 12)); // Timeout active
print(url.toString().substring(0,70)); // <<<< Problem
if (response.statusCode == 200) {
decoded = jsonDecode(response.body);
if (decoded['status'] == 0) {success = false;}
if (decoded['status'] == 1) {success = true;}
} else {success = false;}
} catch (e) {success = false;}
The following http request completely fails if the print line marked ‘<<< Problem’ is included. Anyone have any idea why?
It only occurs when getting a sub string of the ‘url’, and I can imagine it might be actually altering that variable somehow, but this doesn’t seem intuitive and the sequence seems to suggest it shouldn’t matter anyway.
I can’t see why printing a substring of the url variable should affect the line above. I’ve tried removing the .substring and the problem disappears.




