I used flutter to make small application that uses API, when I run the application on mobile it works fine, however when I run it on Chrome (web), it gives an host debug. The API is a sinch API that it is used to send a message.
Please help me know why an APIs may give exception on web. The exception is:
Error: XMLHttpRequest error.
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 299:10 createErrorWithStack
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 355:28 _throw
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/core/errors.dart 120:5 throwWithStackTrace C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1385:11 callback C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15
//Send the request
Uri uri =Uri.parse($sinchAPI);
final response = await http.post(uri,
headers: <String, String>{
"Content-Type": "application/json",
"Authorization": "Bearer $apiToken", },
body: jsonEncode(<String, dynamic>{
"from": from,
"to": phoneNumbersList,
"body": messageController.text,
"type": "mt_text",
"feedback_enabled":"true",
}));