Issue with Flutter HTTP

Viewed 26

I'm having an issue with the http package, this is a web app. Its not giving me an error however, and doesn't make it past the response line. The URL is a local server that is hosted on my machine, I'm using localhost:3003. Its an Http call. First time I ran it I got something like the frame doesn't have index[30] but I haven't been able to get the error again. It just gives a stack. I pasted the console below.



 @override
  Future<List<CustomerInfo>> loadAccounts() async {
    final uri = Uri.parse('http://$baseUrl:$port$accountsPath');
    final response = await http.get(uri);
    if (response.statusCode == 200) {
      final json = jsonDecode(response.body);
      print(json);
      return [];
    } else {
      return [];
    }
  }

Restarted application in 63ms.
Error: XMLHttpRequest error.
dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 963:28                get current
packages/http/src/browser_client.dart 69:22                                       <fn>
dart-sdk/lib/async/zone.dart 1685:54                                              runUnary
dart-sdk/lib/async/future_impl.dart 147:18                                        handleValue
dart-sdk/lib/async/future_impl.dart 766:44                                        handleValueCallback
dart-sdk/lib/async/future_impl.dart 795:13                                        _propagateToListeners
dart-sdk/lib/async/future_impl.dart 557:7                                         [_complete]
dart-sdk/lib/async/stream_pipe.dart 61:11                                         _cancelAndValue
dart-sdk/lib/async/stream.dart 1530:7                                             <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 334:14  _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 339:39  dcall
dart-sdk/lib/html/dart2js/html_dart2js.dart 37309:58                              <fn>
    at Object.createErrorWithStack (http://localhost:61988/dart_sdk.js:5093:12)
    at Error._throw (http://localhost:61988/dart_sdk.js:20399:18)
    at Error.throwWithStackTrace (http://localhost:61988/dart_sdk.js:20396:18)
    at async._AsyncCallbackEntry.new.callback (http://localhost:61988/dart_sdk.js:40921:18)
    at Object._microtaskLoop (http://localhost:61988/dart_sdk.js:40778:13)
    at _startMicrotaskLoop (http://localhost:61988/dart_sdk.js:40784:13)
    at http://localhost:61988/dart_sdk.js:36261:9
0 Answers
Related