I have this furture in my flutter app which is just to fetch the response from the web pages from the list. When I start the app via the console "flutter run" or Android Studio it executes the function correctly. With VS Code since today this error comes up:
address: null
message: Failed host lookup: 'www.google.com'
osError: OSError (OS Error: The requested name is valid, but no data of the requested type was found.
, errno = 11004)
port: null
vs code version: 1.81.1
App was run as a Windows app and on physical devices. Future:
Future<void> fetchGoogle() async {
List<String> urls = [
'https://www.google.com',
'https://stackoverflow.com/questions/ask'
];
for (var url in urls) {
try {
print("request to $url");
final response = await http.get(Uri.parse(url));
if (response.statusCode == 200) {
print('$url response received!');
} else {
print('Failed to fetch from $url.');
}
} on Exception catch (e) {
print('Error (${e.toString()}) to fetch from $url.');
}
}
}
I created a new project, rebooted computer, VS code removed all extensions and reinstalled. No success.