WebViewerHelper class

Unified Web Viewer Helper

Provides a single interface for both HTML content rendering and web page viewing with multiple rendering modes.

Usage Examples

Sanitized HTML (safe for user content)

WebViewerHelper.html('<p>Hello World!</p>')

Web URL with navigation

WebViewerHelper.url('https://example.com', showNavigationControls: true)

Raw HTML (no sanitization - trusted content only)

WebViewerHelper.raw('<script>alert("hi")</script><p>Content</p>')

Styled HTML with configuration

WebViewerHelper.styled(htmlContent, config: HtmlStyleConfig.article())

HTML to Widget conversion

final widget = WebViewerHelper.widget(htmlContent);
String text = widget.extractText();

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

auto(String content, {bool? isUrl, double? height, bool enableFullscreen = false}) Widget
Auto-detect content type and create appropriate viewer
html(String htmlContent, {Map<String, Style>? customStyle, void onLinkTap(String? url, Map<String, String> attributes)?, Widget? loadingWidget, Widget? errorWidget, double? height}) Widget
Create HTML content viewer with sanitization
raw(String htmlContent, {bool showWarning = false, Map<String, Style>? customStyle, void onLinkTap(String? url, Map<String, String> attributes)?, double? height}) Widget
Create raw HTML viewer without sanitization
styled(String htmlContent, {HtmlStyleConfig config = HtmlStyleConfig.defaultConfig, void onLinkTap(String? url, Map<String, String> attributes)?, double? height}) Widget
Create styled HTML viewer with custom configuration
url(String url, {bool showNavigationControls = false, double? height, bool enableFullscreen = false, InAppWebViewSettings? initialSettings, Widget? loadingWidget, Widget? errorWidget, void onLoadStart(InAppWebViewController controller, WebUri? url)?, void onLoadStop(InAppWebViewController controller, WebUri? url)?, void onReceivedError(InAppWebViewController controller, WebUri? url, int code, String message)?, void onReceivedHttpError(InAppWebViewController controller, WebUri? url, int statusCode, String? description)?, void onProgressChanged(InAppWebViewController controller, int progress)?, void onUpdateVisitedHistory(InAppWebViewController controller, WebUri? url, bool? androidIsReload)?, void onConsoleMessage(InAppWebViewController controller, ConsoleMessage consoleMessage)?, void onPermissionRequest(InAppWebViewController controller, PermissionRequest permissionRequest)?, void onDownloadStartRequest(InAppWebViewController controller, DownloadStartRequest downloadStartRequest)?}) Widget
Create web URL viewer
widget(String htmlContent, {HtmlStyleConfig? config}) HtmlWidget
Convert HTML to HtmlWidget for programmatic manipulation