Skip to content

Commit 930f015

Browse files
committed
doc: add Offline Resources Loading.
1 parent afaf455 commit 930f015

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
sidebar_position: 5
3+
title: Offline Resources Loading
4+
---
5+
6+
WebF supports the `https://`, `http://`, `file://`, and `assets://` protocols for fetching external resources.
7+
8+
## `http://` and `https://` Protocols
9+
10+
Like web browsers, the standard method to fetch remote resources is through the HTTP protocol.
11+
12+
```dart
13+
controller = WebFController(
14+
context,
15+
);
16+
controller.preload(WebFBundle.fromUrl('https://xxx.com/demo.html'));
17+
```
18+
19+
## `file://` Protocol
20+
21+
This protocol is used to access any disk location with readable permissions, available on both desktop and mobile platforms.
22+
23+
```dart
24+
controller = WebFController(
25+
context,
26+
);
27+
controller.preload(WebFBundle.fromUrl('file:///data/demo/demo.html'));
28+
```
29+
30+
## `assets://` Protocol
31+
32+
This protocol is used for resources bundled with Flutter assets.
33+
34+
```dart
35+
controller = WebFController(
36+
context,
37+
);
38+
controller.preload(WebFBundle.fromUrl('assets:///assets/bundle.html'));
39+
```

0 commit comments

Comments
 (0)