fetch function
Future<Response>
fetch(
- Object resource, {
- String? method,
- Object? headers,
- Object? body,
- RequestMode? mode,
- RequestCredentials? credentials,
- RequestCache? cache,
- RequestRedirect? redirect,
- String? referrer,
- ReferrerPolicy? referrerPolicy,
- String? integrity,
- bool? keepalive,
- RequestDestination? destination,
The fetch() method starts the process of fetching a resource from the network, returning a promise which is fulfilled once the response is available.
Implementation
Future<Response> fetch(
Object resource, {
String? method,
Object? headers,
Object? body,
RequestMode? mode,
RequestCredentials? credentials,
RequestCache? cache,
RequestRedirect? redirect,
String? referrer,
ReferrerPolicy? referrerPolicy,
String? integrity,
bool? keepalive,
RequestDestination? destination,
}) {
final request = Request(
resource,
method: method,
headers: headers,
body: body,
mode: mode,
credentials: credentials,
cache: cache,
redirect: redirect,
referrer: referrer,
referrerPolicy: referrerPolicy,
integrity: integrity,
destination: destination,
);
return _globalClient.send(request, keepalive: keepalive ?? false);
}