openData method
Future<void>
openData({
- required String data,
- String mimeType = "text/html",
- String encoding = "utf8",
- WebUri? baseUrl,
- @Deprecated("Use historyUrl instead") Uri? androidHistoryUrl,
- WebUri? historyUrl,
- @Deprecated('Use settings instead') InAppBrowserClassOptions? options,
- InAppBrowserClassSettings? settings,
Opens the PlatformInAppBrowser
instance with data
as a content, using baseUrl
as the base URL for it.
The mimeType
parameter specifies the format of the data. The default value is "text/html"
.
The encoding
parameter specifies the encoding of the data. The default value is "utf8"
.
The androidHistoryUrl
parameter is the URL to use as the history entry. The default value is about:blank
. If non-null, this must be a valid URL. This parameter is used only on Android.
The options
parameter specifies the options for the PlatformInAppBrowser
.
settings
: Settings for the PlatformInAppBrowser
.
Officially Supported Platforms/Implementations:
- Android native WebView
- iOS
- MacOS
- Windows
Implementation
@override
Future<void> openData(
{required String data,
String mimeType = "text/html",
String encoding = "utf8",
WebUri? baseUrl,
@Deprecated("Use historyUrl instead") Uri? androidHistoryUrl,
WebUri? historyUrl,
// ignore: deprecated_member_use_from_same_package
@Deprecated('Use settings instead') InAppBrowserClassOptions? options,
InAppBrowserClassSettings? settings}) async {
Map<String, dynamic> args =
_prepareOpenRequest(options: options, settings: settings);
args.putIfAbsent('data', () => data);
args.putIfAbsent('mimeType', () => mimeType);
args.putIfAbsent('encoding', () => encoding);
args.putIfAbsent('baseUrl', () => baseUrl?.toString() ?? "about:blank");
args.putIfAbsent('historyUrl',
() => (historyUrl ?? androidHistoryUrl)?.toString() ?? "about:blank");
await _staticChannel.invokeMethod('open', args);
}