/
inappwebview_platform.dart
454 lines (409 loc) · 18.8 KB
/
inappwebview_platform.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'chrome_safari_browser/platform_chrome_safari_browser.dart';
import 'find_interaction/platform_find_interaction_controller.dart';
import 'in_app_browser/platform_in_app_browser.dart';
import 'in_app_webview/platform_headless_in_app_webview.dart';
import 'in_app_webview/platform_inappwebview_controller.dart';
import 'in_app_webview/platform_inappwebview_widget.dart';
import 'platform_cookie_manager.dart';
import 'platform_http_auth_credentials_database.dart';
import 'platform_in_app_localhost_server.dart';
import 'print_job/platform_print_job_controller.dart';
import 'pull_to_refresh/platform_pull_to_refresh_controller.dart';
import 'web_authentication_session/platform_web_authenticate_session.dart';
import 'web_message/platform_web_message_channel.dart';
import 'web_message/platform_web_message_listener.dart';
import 'web_message/platform_web_message_port.dart';
import 'web_storage/platform_web_storage.dart';
import 'web_storage/platform_web_storage_manager.dart';
import 'platform_process_global_config.dart';
import 'platform_proxy_controller.dart';
import 'platform_service_worker_controller.dart';
import 'platform_tracing_controller.dart';
import 'platform_webview_asset_loader.dart';
import 'platform_webview_feature.dart';
import 'in_app_localhost_server.dart';
import 'webview_environment/platform_webview_environment.dart';
/// Interface for a platform implementation of a WebView.
abstract class InAppWebViewPlatform extends PlatformInterface {
/// Creates a new [InAppWebViewPlatform].
InAppWebViewPlatform() : super(token: _token);
static final Object _token = Object();
static InAppWebViewPlatform? _instance;
/// The instance of [InAppWebViewPlatform] to use.
static InAppWebViewPlatform? get instance => _instance;
/// Platform-specific plugins should set this with their own platform-specific
/// class that extends [InAppWebViewPlatform] when they register themselves.
static set instance(InAppWebViewPlatform? instance) {
if (instance == null) {
throw AssertionError(
'Platform interfaces can only be set to a non-null instance');
}
PlatformInterface.verify(instance, _token);
_instance = instance;
}
/// Creates a new [PlatformCookieManager].
///
/// This function should only be called by the app-facing package.
/// Look at using [CookieManager] in `flutter_inappwebview` instead.
PlatformCookieManager createPlatformCookieManager(
PlatformCookieManagerCreationParams params,
) {
throw UnimplementedError(
'createPlatformCookieManager is not implemented on the current platform.');
}
/// Creates a new [PlatformInAppWebViewController].
///
/// This function should only be called by the app-facing package.
/// Look at using [InAppWebViewController] in `flutter_inappwebview` instead.
PlatformInAppWebViewController createPlatformInAppWebViewController(
PlatformInAppWebViewControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformInAppWebViewController is not implemented on the current platform.');
}
/// Creates a new empty [PlatformInAppWebViewController] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [InAppWebViewController] in `flutter_inappwebview` instead.
PlatformInAppWebViewController createPlatformInAppWebViewControllerStatic() {
throw UnimplementedError(
'createPlatformInAppWebViewControllerStatic is not implemented on the current platform.');
}
/// Creates a new [PlatformInAppWebViewWidget].
///
/// This function should only be called by the app-facing package.
/// Look at using [InAppWebView] in `flutter_inappwebview` instead.
PlatformInAppWebViewWidget createPlatformInAppWebViewWidget(
PlatformInAppWebViewWidgetCreationParams params,
) {
throw UnimplementedError(
'createPlatformInAppWebViewWidget is not implemented on the current platform.');
}
/// Creates a new [PlatformFindInteractionController].
///
/// This function should only be called by the app-facing package.
/// Look at using [FindInteractionController] in `flutter_inappwebview` instead.
PlatformFindInteractionController createPlatformFindInteractionController(
PlatformFindInteractionControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformFindInteractionController is not implemented on the current platform.');
}
/// Creates a new [PlatformPrintJobController].
///
/// This function should only be called by the app-facing package.
/// Look at using [PrintJobController] in `flutter_inappwebview` instead.
PlatformPrintJobController createPlatformPrintJobController(
PlatformPrintJobControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformPrintJobController is not implemented on the current platform.');
}
/// Creates a new [PlatformPullToRefreshController].
///
/// This function should only be called by the app-facing package.
/// Look at using [PullToRefreshController] in `flutter_inappwebview` instead.
PlatformPullToRefreshController createPlatformPullToRefreshController(
PlatformPullToRefreshControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformPullToRefreshController is not implemented on the current platform.');
}
/// Creates a new [PlatformWebAuthenticationSession].
///
/// This function should only be called by the app-facing package.
/// Look at using [WebAuthenticationSession] in `flutter_inappwebview` instead.
PlatformWebAuthenticationSession createPlatformWebAuthenticationSession(
PlatformWebAuthenticationSessionCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebAuthenticationSession is not implemented on the current platform.');
}
/// Creates a new empty [PlatformWebAuthenticationSession] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [WebAuthenticationSession] in `flutter_inappwebview` instead.
PlatformWebAuthenticationSession
createPlatformWebAuthenticationSessionStatic() {
throw UnimplementedError(
'createPlatformWebAuthenticationSessionStatic is not implemented on the current platform.');
}
/// Creates a new [PlatformWebMessageChannel].
///
/// This function should only be called by the app-facing package.
/// Look at using [WebMessageChannel] in `flutter_inappwebview` instead.
PlatformWebMessageChannel createPlatformWebMessageChannel(
PlatformWebMessageChannelCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebMessageChannel is not implemented on the current platform.');
}
/// Creates a new empty [PlatformWebMessageChannel] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [WebMessageChannel] in `flutter_inappwebview` instead.
PlatformWebMessageChannel createPlatformWebMessageChannelStatic() {
throw UnimplementedError(
'createPlatformWebMessageChannelStatic is not implemented on the current platform.');
}
/// Creates a new [PlatformWebMessageListener].
///
/// This function should only be called by the app-facing package.
/// Look at using [WebMessageListener] in `flutter_inappwebview` instead.
PlatformWebMessageListener createPlatformWebMessageListener(
PlatformWebMessageListenerCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebMessageListener is not implemented on the current platform.');
}
/// Creates a new [PlatformJavaScriptReplyProxy].
///
/// This function should only be called by the app-facing package.
/// Look at using [JavaScriptReplyProxy] in `flutter_inappwebview` instead.
PlatformJavaScriptReplyProxy createPlatformJavaScriptReplyProxy(
PlatformJavaScriptReplyProxyCreationParams params,
) {
throw UnimplementedError(
'createPlatformJavaScriptReplyProxy is not implemented on the current platform.');
}
/// Creates a new [PlatformWebMessagePort].
///
/// This function should only be called by the app-facing package.
/// Look at using [WebMessagePort] in `flutter_inappwebview` instead.
PlatformWebMessagePort createPlatformWebMessagePort(
PlatformWebMessagePortCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebMessagePort is not implemented on the current platform.');
}
/// Creates a new [PlatformWebStorage].
///
/// This function should only be called by the app-facing package.
/// Look at using [WebStorage] in `flutter_inappwebview` instead.
PlatformWebStorage createPlatformWebStorage(
PlatformWebStorageCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebStorage is not implemented on the current platform.');
}
/// Creates a new [PlatformLocalStorage].
///
/// This function should only be called by the app-facing package.
/// Look at using [LocalStorage] in `flutter_inappwebview` instead.
PlatformLocalStorage createPlatformLocalStorage(
PlatformLocalStorageCreationParams params,
) {
throw UnimplementedError(
'createPlatformLocalStorage is not implemented on the current platform.');
}
/// Creates a new [PlatformSessionStorage].
///
/// This function should only be called by the app-facing package.
/// Look at using [PlatformSessionStorage] in `flutter_inappwebview` instead.
PlatformSessionStorage createPlatformSessionStorage(
PlatformSessionStorageCreationParams params,
) {
throw UnimplementedError(
'createPlatformSessionStorage is not implemented on the current platform.');
}
/// Creates a new [PlatformHeadlessInAppWebView].
///
/// This function should only be called by the app-facing package.
/// Look at using [HeadlessInAppWebView] in `flutter_inappwebview` instead.
PlatformHeadlessInAppWebView createPlatformHeadlessInAppWebView(
PlatformHeadlessInAppWebViewCreationParams params,
) {
throw UnimplementedError(
'createPlatformHeadlessInAppWebView is not implemented on the current platform.');
}
/// Creates a new [PlatformWebStorageManager].
///
/// This function should only be called by the app-facing package.
/// Look at using [CookieManager] in `flutter_inappwebview` instead.
PlatformWebStorageManager createPlatformWebStorageManager(
PlatformWebStorageManagerCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebStorageManager is not implemented on the current platform.');
}
/// Creates a new [PlatformHttpAuthCredentialDatabase].
///
/// This function should only be called by the app-facing package.
/// Look at using [HttpAuthCredentialDatabase] in `flutter_inappwebview` instead.
PlatformHttpAuthCredentialDatabase createPlatformHttpAuthCredentialDatabase(
PlatformHttpAuthCredentialDatabaseCreationParams params,
) {
throw UnimplementedError(
'createPlatformHttpAuthCredentialDatabase is not implemented on the current platform.');
}
/// Creates a new [PlatformInAppBrowser].
///
/// This function should only be called by the app-facing package.
/// Look at using [InAppBrowser] in `flutter_inappwebview` instead.
PlatformInAppBrowser createPlatformInAppBrowser(
PlatformInAppBrowserCreationParams params,
) {
throw UnimplementedError(
'createPlatformInAppBrowser is not implemented on the current platform.');
}
/// Creates a new empty [PlatformInAppBrowser] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [InAppBrowser] in `flutter_inappwebview` instead.
PlatformInAppBrowser createPlatformInAppBrowserStatic() {
throw UnimplementedError(
'createPlatformInAppBrowserStatic is not implemented on the current platform.');
}
/// Creates a new [PlatformProcessGlobalConfig].
///
/// This function should only be called by the app-facing package.
/// Look at using [ProcessGlobalConfig] in `flutter_inappwebview` instead.
PlatformProcessGlobalConfig createPlatformProcessGlobalConfig(
PlatformProcessGlobalConfigCreationParams params,
) {
throw UnimplementedError(
'createPlatformProcessGlobalConfig is not implemented on the current platform.');
}
/// Creates a new [PlatformProxyController].
///
/// This function should only be called by the app-facing package.
/// Look at using [ProxyController] in `flutter_inappwebview` instead.
PlatformProxyController createPlatformProxyController(
PlatformProxyControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformProxyController is not implemented on the current platform.');
}
/// Creates a new [PlatformServiceWorkerController].
///
/// This function should only be called by the app-facing package.
/// Look at using [ServiceWorkerController] in `flutter_inappwebview` instead.
PlatformServiceWorkerController createPlatformServiceWorkerController(
PlatformServiceWorkerControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformServiceWorkerController is not implemented on the current platform.');
}
/// Creates a new empty [PlatformServiceWorkerController] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [ServiceWorkerController] in `flutter_inappwebview` instead.
PlatformServiceWorkerController
createPlatformServiceWorkerControllerStatic() {
throw UnimplementedError(
'createPlatformServiceWorkerControllerStatic is not implemented on the current platform.');
}
/// Creates a new [PlatformTracingController].
///
/// This function should only be called by the app-facing package.
/// Look at using [TracingController] in `flutter_inappwebview` instead.
PlatformTracingController createPlatformTracingController(
PlatformTracingControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformTracingController is not implemented on the current platform.');
}
/// Creates a new [PlatformAssetsPathHandler].
///
/// This function should only be called by the app-facing package.
/// Look at using [AssetsPathHandler] in `flutter_inappwebview` instead.
PlatformAssetsPathHandler createPlatformAssetsPathHandler(
PlatformAssetsPathHandlerCreationParams params,
) {
throw UnimplementedError(
'createPlatformAssetsPathHandler is not implemented on the current platform.');
}
/// Creates a new [PlatformResourcesPathHandler].
///
/// This function should only be called by the app-facing package.
/// Look at using [ResourcesPathHandler] in `flutter_inappwebview` instead.
PlatformResourcesPathHandler createPlatformResourcesPathHandler(
PlatformResourcesPathHandlerCreationParams params,
) {
throw UnimplementedError(
'createPlatformResourcesPathHandler is not implemented on the current platform.');
}
/// Creates a new [PlatformInternalStoragePathHandler].
///
/// This function should only be called by the app-facing package.
/// Look at using [InternalStoragePathHandler] in `flutter_inappwebview` instead.
PlatformInternalStoragePathHandler createPlatformInternalStoragePathHandler(
PlatformInternalStoragePathHandlerCreationParams params,
) {
throw UnimplementedError(
'createPlatformInternalStoragePathHandler is not implemented on the current platform.');
}
/// Creates a new [PlatformCustomPathHandler].
///
/// This function should only be called by the app-facing package.
/// Look at using [CustomPathHandler] in `flutter_inappwebview` instead.
PlatformCustomPathHandler createPlatformCustomPathHandler(
PlatformCustomPathHandlerCreationParams params,
) {
throw UnimplementedError(
'createPlatformCustomPathHandler is not implemented on the current platform.');
}
/// Creates a new [PlatformWebViewFeature].
///
/// This function should only be called by the app-facing package.
/// Look at using [WebViewFeature] in `flutter_inappwebview` instead.
PlatformWebViewFeature createPlatformWebViewFeature(
PlatformWebViewFeatureCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebViewFeature is not implemented on the current platform.');
}
/// Creates a new empty [PlatformWebViewFeature] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [WebViewFeature] in `flutter_inappwebview` instead.
PlatformWebViewFeature createPlatformWebViewFeatureStatic() {
throw UnimplementedError(
'createPlatformWebViewFeatureStatic is not implemented on the current platform.');
}
/// Creates a new empty [PlatformInAppLocalhostServer] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [DefaultInAppLocalhostServer] in `flutter_inappwebview` instead.
PlatformInAppLocalhostServer createPlatformInAppLocalhostServer(
PlatformInAppLocalhostServerCreationParams params) {
return DefaultInAppLocalhostServer(params);
}
/// Creates a new [PlatformChromeSafariBrowser].
///
/// This function should only be called by the app-facing package.
/// Look at using [ChromeSafariBrowser] in `flutter_inappwebview` instead.
PlatformChromeSafariBrowser createPlatformChromeSafariBrowser(
PlatformChromeSafariBrowserCreationParams params,
) {
throw UnimplementedError(
'createPlatformChromeSafariBrowser is not implemented on the current platform.');
}
/// Creates a new empty [PlatformChromeSafariBrowser] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [ChromeSafariBrowser] in `flutter_inappwebview` instead.
PlatformChromeSafariBrowser createPlatformChromeSafariBrowserStatic() {
throw UnimplementedError(
'createPlatformChromeSafariBrowserStatic is not implemented on the current platform.');
}
/// Creates a new [PlatformWebViewEnvironment].
///
/// This function should only be called by the app-facing package.
/// Look at using [WebViewEnvironment] in `flutter_inappwebview` instead.
PlatformWebViewEnvironment createPlatformWebViewEnvironment(
PlatformWebViewEnvironmentCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebViewEnvironment is not implemented on the current platform.');
}
/// Creates a new empty [PlatformWebViewEnvironment] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [WebViewEnvironment] in `flutter_inappwebview` instead.
PlatformWebViewEnvironment createPlatformWebViewEnvironmentStatic() {
throw UnimplementedError(
'createPlatformWebViewEnvironmentStatic is not implemented on the current platform.');
}
}