Simple http request with basicauth

Hello together,

I don’t really want to do anything other than a simple http-request with a GET parameter and Basic Auth.

For this I have written the following small class. However, not much seems to happen here. The request is started but it doesn’t seem to return any result. It runs and runs and should timeout or something like that.

class HttpService {
  Future<List<Post>> getPosts() async {
    final queryParameters = {
      'data_type': 'temps_today',
    };

    String username = 'user';
    String password = 'password';
    String basicAuth =
        'Basic ' + base64Encode(utf8.encode('$username:$password'));
    print(basicAuth);

    Response res  = await get(Uri.https('mydomain.com', '/gartentemp/api/get_temp_data.php', queryParameters), headers: <String, String>{'authorization': basicAuth}); //stucks here
    print(res.statusCode);
    if (res.statusCode == 200) {
      List<dynamic> body = jsonDecode(res.body);

      List<Post> posts = body
          .map(
            (dynamic item) => Post.fromJson(item),
      )
          .toList();

      return posts;
    } else {
      throw "Unable to retrieve posts.";
    }
  }
}

In the browser a JSON file is delivered without any problems.

Whats wrong with my try?

Thx niesel