I'm trying to get some data from this API, I got the XMLHttpRequest
error even when I use this solution:
import 'package:http/http.dart' as http;
void main() async {
var _headers = {
"Access-Control-Allow-Origin": "*",
'X-API-KEY': 'SqD712P3E82xnwOAEOkGd5JZH8s9wRR24TqNFzjk'
};
var url = "https://api.sunnah.com/v1/collections/muslim";
var res = await http.get(Uri.parse(url), headers:_headers);
print(res.body);
}