@@ -18,59 +18,6 @@ yet, so it currently requires extra setup to use:
18
18
* [ Add this package] ( https://pub.dev/packages/webview_flutter_web/install )
19
19
as an explicit dependency of your project, in addition to depending on
20
20
` webview_flutter ` .
21
- * Register ` WebWebViewPlatform ` as the ` WebViewPlatform.instance ` before creating a
22
- ` WebView ` . See below for examples.
23
21
24
- Once those steps below are complete, the APIs from ` webview_flutter ` listed
22
+ Once the step above is complete, the APIs from ` webview_flutter ` listed
25
23
above can be used as normal on web.
26
-
27
- ### Registering the implementation
28
-
29
- Before creating a ` WebView ` (for instance, at the start of ` main ` ), you will
30
- need to register the web implementation.
31
-
32
- #### Web-only project example
33
-
34
- ``` dart
35
- ...
36
- import 'package:webview_flutter/webview_flutter.dart';
37
- import 'package:webview_flutter_web/webview_flutter_web.dart';
38
-
39
- main() {
40
- WebViewPlatform.instance = WebWebViewPlatform();
41
- ...
42
- ```
43
-
44
- #### Multi-platform project example
45
-
46
- If your project supports platforms other than web, you will need to use a
47
- conditional import to avoid directly including ` webview_flutter_web.dart ` on
48
- non-web platforms. For example:
49
-
50
- ` register_web_webview.dart ` :
51
- ``` dart
52
- import 'package:webview_flutter/webview_flutter.dart';
53
- import 'package:webview_flutter_web/webview_flutter_web.dart';
54
-
55
- void registerWebViewWebImplementation() {
56
- WebViewPlatform.instance = WebWebViewPlatform();
57
- }
58
- ```
59
-
60
- ` register_web_webview_stub.dart ` :
61
- ``` dart
62
- void registerWebViewWebImplementation() {
63
- // No-op.
64
- }
65
- ```
66
-
67
- ` main.dart ` :
68
- ``` dart
69
- ...
70
- import 'register_web_webview_stub.dart'
71
- if (dart.library.html) 'register_web.dart';
72
-
73
- main() {
74
- registerWebViewWebImplementation();
75
- ...
76
- ```
0 commit comments