fetch function

Future<Response> fetch(
  1. Object input, [
  2. RequestInit? init
])

Fetch a resource from the network. It returns a Promise that resolves to the Response to that Request, whether it is successful or not.

const response = await fetch("http://my.json.host/data.json");
console.log(response.status);  // e.g. 200
console.log(response.statusText); // e.g. "OK"
const jsonData = await response.json();

Implementation

_i2.Future<_i3.Response> fetch(
  _i2.Object input, [
  _i3.RequestInit? init,
]) =>
    _i4.promiseToFuture(_i4.callMethod(
      _self,
      'fetch',
      [
        input,
        init ?? _i6.undefined,
      ],
    ));