XMLHttpRequest error, cannot use http.get method

Hi, I need to fetch some simple json from API, but the code gives XML Http requst error. Is this an bug?
Screenshot:
image

import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;

class NetService {
  static Future<T> getJson<T>(String url) {
    return http.get(Uri.parse(url)).then((response) {
      if (response.statusCode == 200) {
        return jsonDecode(response.body) as T;
      }
      print('Status Code : ${response.statusCode}...');
      return jsonDecode(response.body) as T;
    }).catchError((err) => print(err));
  }
}

class IOT {
  List data;
  FutureOr<void> fetchMeasurements() async {
    await NetService.getJson<Map<String, dynamic>>(
            'http://iot.productio.net/api/Measurement/GetMeasurements')
        .then((response) {
      data = (response != null && response['IsSuccess'])
          ? response['Entity']
          : null;
    }).whenComplete(() => print('Fetching done!....'));
  }
}

void main(List<String> args) async {
  var iot = IOT();
  await iot.fetchMeasurements();
  print(iot.data.take(3).toString());
}```


1 possible answer(s) on “XMLHttpRequest error, cannot use http.get method