HTTP Request from inside WASM in Dart using package:fetch_client

This example uses packages/fetch_client.

See the output in browser developer console.

Actual code:


import 'package:fetch_client/fetch_client.dart';

final client = FetchClient(mode: RequestMode.cors);
final uri = Uri.parse('https://httpbin.org/anything');
final resp = await client.get(uri);

print('${resp.body}');
client.close();

Info