File tree 6 files changed +436
-2
lines changed 6 files changed +436
-2
lines changed Original file line number Diff line number Diff line change 8
8
< h2 > HTTP request from inside WASM in Dart - list of demos</ h2 >
9
9
10
10
< ol >
11
+ < li > < a href ="package-dio/ "> Demo using package:dio</ a > </ li >
11
12
< li > < a href ="package-fetch-api/ "> Demo using package:fetch_api</ a > </ li >
12
13
< li > < a href ="package-fetch-client/ "> Demo using package:fetch_client</ a > </ li >
13
14
< li > < a href ="package-http/ "> Demo using package:http</ a > </ li >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+
4
+ < head >
5
+ < meta charset ="UTF-8 ">
6
+ < title > HTTP request from WASM in Dart using package:dio</ title >
7
+ < script type ="module ">
8
+ import { instantiate , invoke } from "./main.mjs" ;
9
+
10
+ const module = await WebAssembly . compileStreaming ( fetch ( 'main.wasm' ) ) ;
11
+ const instance = await instantiate ( module ) ;
12
+ invoke ( instance ) ;
13
+ </ script >
14
+ </ head >
15
+
16
+ < body >
17
+ < h2 > HTTP Request from inside WASM in Dart using package:dio</ h2 >
18
+
19
+ < p > This example uses < a href ="https://pub.dev/packages/dio "> packages/dio</ a > .</ p >
20
+
21
+ < p > See the output in browser developer console.</ p >
22
+
23
+ < p > Actual code:</ p >
24
+ < pre >
25
+
26
+ import 'package:dio/dio.dart';
27
+
28
+ final dio = Dio();
29
+ Response response = await dio.get('https://httpbin.org/anything');
30
+ print(response);
31
+
32
+ </ pre >
33
+ < section >
34
+ < h4 > Info</ h4 >
35
+ < ul >
36
+ < li > < a href ="https://github.com/wasm-outbound-http-examples/dart/tree/main/browser-package-dio "> Demo
37
+ source code</ a > </ li >
38
+ < li > Versions used on the moment of build:< small >
39
+ Dart SDK: < a href ="https://github.com/dart-lang/sdk/releases/tag/3.5.2 "> v3.5.2</ a > ,
40
+ package:dio: < a href ="https://pub.dev/packages/dio/versions/5.7.0 "> v5.7.0</ a > .
41
+ </ small > </ li >
42
+ </ ul >
43
+ </ section >
44
+ < footer > < small > Created for (wannabe-awesome) < a href ="https://github.com/vasilev/HTTP-request-from-inside-WASM "> list</ a > </ small > </ footer >
45
+ </ body >
46
+ </ html >
You can’t perform that action at this time.
0 commit comments