fromMap static method
- Map<
String, dynamic> ? map, { - EnumMethod? enumMethod,
Gets a possible InAppWebViewSettings instance from a Map value.
Implementation
static InAppWebViewSettings? fromMap(
Map<String, dynamic>? map, {
EnumMethod? enumMethod,
}) {
if (map == null) {
return null;
}
final instance = InAppWebViewSettings(
allowingReadAccessTo: map['allowingReadAccessTo'] != null
? WebUri(map['allowingReadAccessTo'])
: null,
alpha: map['alpha'],
appCachePath: map['appCachePath'],
containerId: map['containerId'],
corsAllowlist: map['corsAllowlist'] != null
? List<String>.from(map['corsAllowlist']!.cast<String>())
: null,
cursorBlinkTime: map['cursorBlinkTime'],
darkMode: map['darkMode'],
defaultVideoPoster: map['defaultVideoPoster'] != null
? Uint8List.fromList(map['defaultVideoPoster'].cast<int>())
: null,
disableAnimations: map['disableAnimations'],
disabledActionModeMenuItems: switch (enumMethod ??
EnumMethod.nativeValue) {
EnumMethod.nativeValue => ActionModeMenuItem.fromNativeValue(
map['disabledActionModeMenuItems'],
),
EnumMethod.value => ActionModeMenuItem.fromValue(
map['disabledActionModeMenuItems'],
),
EnumMethod.name => ActionModeMenuItem.byName(
map['disabledActionModeMenuItems'],
),
},
doubleClickDistance: map['doubleClickDistance'],
doubleClickTime: map['doubleClickTime'],
dragThreshold: map['dragThreshold'],
fontAntialias: map['fontAntialias'],
fontDPI: map['fontDPI'],
fontHintingStyle: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => FontHintingStyle.fromNativeValue(
map['fontHintingStyle'],
),
EnumMethod.value => FontHintingStyle.fromValue(map['fontHintingStyle']),
EnumMethod.name => FontHintingStyle.byName(map['fontHintingStyle']),
},
fontSubpixelLayout: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => FontSubpixelLayout.fromNativeValue(
map['fontSubpixelLayout'],
),
EnumMethod.value => FontSubpixelLayout.fromValue(
map['fontSubpixelLayout'],
),
EnumMethod.name => FontSubpixelLayout.byName(map['fontSubpixelLayout']),
},
forceDark: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => ForceDark.fromNativeValue(map['forceDark']),
EnumMethod.value => ForceDark.fromValue(map['forceDark']),
EnumMethod.name => ForceDark.byName(map['forceDark']),
},
forceDarkStrategy: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => ForceDarkStrategy.fromNativeValue(
map['forceDarkStrategy'],
),
EnumMethod.value => ForceDarkStrategy.fromValue(
map['forceDarkStrategy'],
),
EnumMethod.name => ForceDarkStrategy.byName(map['forceDarkStrategy']),
},
horizontalScrollbarThumbColor:
map['horizontalScrollbarThumbColor'] != null
? UtilColor.fromStringRepresentation(
map['horizontalScrollbarThumbColor'],
)
: null,
horizontalScrollbarTrackColor:
map['horizontalScrollbarTrackColor'] != null
? UtilColor.fromStringRepresentation(
map['horizontalScrollbarTrackColor'],
)
: null,
iframeAllow: map['iframeAllow'],
iframeAllowFullscreen: map['iframeAllowFullscreen'],
iframeAriaHidden: map['iframeAriaHidden'],
iframeCsp: map['iframeCsp'],
iframeName: map['iframeName'],
iframeReferrerPolicy: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => ReferrerPolicy.fromNativeValue(
map['iframeReferrerPolicy'],
),
EnumMethod.value => ReferrerPolicy.fromValue(
map['iframeReferrerPolicy'],
),
EnumMethod.name => ReferrerPolicy.byName(map['iframeReferrerPolicy']),
},
iframeRole: map['iframeRole'],
iframeSandbox: map['iframeSandbox'] != null
? Set<Sandbox>.from(
map['iframeSandbox']
.map(
(e) => switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => Sandbox.fromNativeValue(e),
EnumMethod.value => Sandbox.fromValue(e),
EnumMethod.name => Sandbox.byName(e),
},
)
.whereType<Sandbox>(),
)
: null,
javaScriptBridgeForMainFrameOnly: map['javaScriptBridgeForMainFrameOnly'],
javaScriptBridgeOriginAllowList:
map['javaScriptBridgeOriginAllowList'] != null
? Set<String>.from(
map['javaScriptBridgeOriginAllowList']!.cast<String>(),
)
: null,
javaScriptHandlersForMainFrameOnly:
map['javaScriptHandlersForMainFrameOnly'],
javaScriptHandlersOriginAllowList:
map['javaScriptHandlersOriginAllowList'] != null
? Set<String>.from(
map['javaScriptHandlersOriginAllowList']!.cast<String>(),
)
: null,
keyRepeatDelay: map['keyRepeatDelay'],
keyRepeatInterval: map['keyRepeatInterval'],
layoutAlgorithm: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => LayoutAlgorithm.fromNativeValue(
map['layoutAlgorithm'],
),
EnumMethod.value => LayoutAlgorithm.fromValue(map['layoutAlgorithm']),
EnumMethod.name => LayoutAlgorithm.byName(map['layoutAlgorithm']),
},
maximumViewportInset: MapEdgeInsets.fromMap(
map['maximumViewportInset']?.cast<String, dynamic>(),
),
mediaContentTypesRequiringHardwareSupport:
map['mediaContentTypesRequiringHardwareSupport'],
mediaType: map['mediaType'],
minimumFontSize: map['minimumFontSize'],
minimumViewportInset: MapEdgeInsets.fromMap(
map['minimumViewportInset']?.cast<String, dynamic>(),
),
mixedContentMode: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => MixedContentMode.fromNativeValue(
map['mixedContentMode'],
),
EnumMethod.value => MixedContentMode.fromValue(map['mixedContentMode']),
EnumMethod.name => MixedContentMode.byName(map['mixedContentMode']),
},
networkAvailable: map['networkAvailable'],
paymentRequestEnabled: map['paymentRequestEnabled'],
pictographFontFamily: map['pictographFontFamily'],
pluginScriptsOriginAllowList: map['pluginScriptsOriginAllowList'] != null
? Set<String>.from(
map['pluginScriptsOriginAllowList']!.cast<String>(),
)
: null,
proxySettings: ProxySettings.fromMap(
map['proxySettings']?.cast<String, dynamic>(),
enumMethod: enumMethod,
),
regexToAllowSyncUrlLoading: map['regexToAllowSyncUrlLoading'],
regexToCancelSubFramesLoading: map['regexToCancelSubFramesLoading'],
rendererPriorityPolicy: RendererPriorityPolicy.fromMap(
map['rendererPriorityPolicy']?.cast<String, dynamic>(),
enumMethod: enumMethod,
),
requestedWithHeaderOriginAllowList:
map['requestedWithHeaderOriginAllowList'] != null
? Set<String>.from(
map['requestedWithHeaderOriginAllowList']!.cast<String>(),
)
: null,
scrollBarDefaultDelayBeforeFade: map['scrollBarDefaultDelayBeforeFade'],
scrollBarFadeDuration: map['scrollBarFadeDuration'],
textZoom: map['textZoom'],
underPageBackgroundColor: map['underPageBackgroundColor'] != null
? UtilColor.fromStringRepresentation(map['underPageBackgroundColor'])
: null,
useOnAjaxProgress: map['useOnAjaxProgress'],
useOnAjaxReadyStateChange: map['useOnAjaxReadyStateChange'],
useOnDownloadStart: map['useOnDownloadStart'],
useOnLoadResource: map['useOnLoadResource'],
useOnNavigationResponse: map['useOnNavigationResponse'],
useOnRenderProcessGone: map['useOnRenderProcessGone'],
useOnShowFileChooser: map['useOnShowFileChooser'],
useShouldInterceptAjaxRequest: map['useShouldInterceptAjaxRequest'],
useShouldInterceptFetchRequest: map['useShouldInterceptFetchRequest'],
useShouldInterceptRequest: map['useShouldInterceptRequest'],
useShouldOverrideUrlLoading: map['useShouldOverrideUrlLoading'],
verticalScrollbarThumbColor: map['verticalScrollbarThumbColor'] != null
? UtilColor.fromStringRepresentation(
map['verticalScrollbarThumbColor'],
)
: null,
verticalScrollbarTrackColor: map['verticalScrollbarTrackColor'] != null
? UtilColor.fromStringRepresentation(
map['verticalScrollbarTrackColor'],
)
: null,
webAuthenticationSupport: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => WebAuthenticationSupport.fromNativeValue(
map['webAuthenticationSupport'],
),
EnumMethod.value => WebAuthenticationSupport.fromValue(
map['webAuthenticationSupport'],
),
EnumMethod.name => WebAuthenticationSupport.byName(
map['webAuthenticationSupport'],
),
},
webRTCUdpPortsRange: map['webRTCUdpPortsRange'],
webViewAssetLoader: WebViewAssetLoader.fromMap(
map['webViewAssetLoader']?.cast<String, dynamic>(),
enumMethod: enumMethod,
),
writingToolsBehavior: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => IOSWritingToolsBehavior.fromNativeValue(
map['writingToolsBehavior'],
),
EnumMethod.value => IOSWritingToolsBehavior.fromValue(
map['writingToolsBehavior'],
),
EnumMethod.name => IOSWritingToolsBehavior.byName(
map['writingToolsBehavior'],
),
},
);
instance.accessibilityIgnoresInvertColors =
map['accessibilityIgnoresInvertColors'];
instance.algorithmicDarkeningAllowed = map['algorithmicDarkeningAllowed'];
instance.allowBackgroundAudioPlaying = map['allowBackgroundAudioPlaying'];
instance.allowContentAccess = map['allowContentAccess'];
instance.allowFileAccess = map['allowFileAccess'];
instance.allowFileAccessFromFileURLs = map['allowFileAccessFromFileURLs'];
instance.allowModalDialogs = map['allowModalDialogs'];
instance.allowTopNavigationToDataUrls = map['allowTopNavigationToDataUrls'];
instance.allowUniversalAccessFromFileURLs =
map['allowUniversalAccessFromFileURLs'];
instance.allowsAirPlayForMediaPlayback =
map['allowsAirPlayForMediaPlayback'];
instance.allowsBackForwardNavigationGestures =
map['allowsBackForwardNavigationGestures'];
instance.allowsInlineMediaPlayback = map['allowsInlineMediaPlayback'];
instance.allowsLinkPreview = map['allowsLinkPreview'];
instance.allowsPictureInPictureMediaPlayback =
map['allowsPictureInPictureMediaPlayback'];
instance.alwaysBounceHorizontal = map['alwaysBounceHorizontal'];
instance.alwaysBounceVertical = map['alwaysBounceVertical'];
instance.applePayAPIEnabled = map['applePayAPIEnabled'];
instance.applicationNameForUserAgent = map['applicationNameForUserAgent'];
instance.automaticallyAdjustsScrollIndicatorInsets =
map['automaticallyAdjustsScrollIndicatorInsets'];
instance.blockNetworkImage = map['blockNetworkImage'];
instance.blockNetworkLoads = map['blockNetworkLoads'];
instance.browserAcceleratorKeysEnabled =
map['browserAcceleratorKeysEnabled'];
instance.builtInZoomControls = map['builtInZoomControls'];
instance.cacheEnabled = map['cacheEnabled'];
instance.cacheMode = switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => CacheMode.fromNativeValue(map['cacheMode']),
EnumMethod.value => CacheMode.fromValue(map['cacheMode']),
EnumMethod.name => CacheMode.byName(map['cacheMode']),
};
instance.clearCache = map['clearCache'];
instance.clearSessionCache = map['clearSessionCache'];
instance.contentBlockers = _deserializeContentBlockers(
map['contentBlockers'],
enumMethod: enumMethod,
);
instance.contentInsetAdjustmentBehavior = switch (enumMethod ??
EnumMethod.nativeValue) {
EnumMethod.nativeValue =>
ScrollViewContentInsetAdjustmentBehavior.fromNativeValue(
map['contentInsetAdjustmentBehavior'],
),
EnumMethod.value => ScrollViewContentInsetAdjustmentBehavior.fromValue(
map['contentInsetAdjustmentBehavior'],
),
EnumMethod.name => ScrollViewContentInsetAdjustmentBehavior.byName(
map['contentInsetAdjustmentBehavior'],
),
};
instance.cursiveFontFamily = map['cursiveFontFamily'];
instance.dataDetectorTypes = map['dataDetectorTypes'] != null
? List<DataDetectorTypes>.from(
map['dataDetectorTypes']
.map(
(e) => switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => DataDetectorTypes.fromNativeValue(
e,
),
EnumMethod.value => DataDetectorTypes.fromValue(e),
EnumMethod.name => DataDetectorTypes.byName(e),
},
)
.whereType<DataDetectorTypes>(),
)
: null;
instance.databaseEnabled = map['databaseEnabled'];
instance.decelerationRate = switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => ScrollViewDecelerationRate.fromNativeValue(
map['decelerationRate'],
),
EnumMethod.value => ScrollViewDecelerationRate.fromValue(
map['decelerationRate'],
),
EnumMethod.name => ScrollViewDecelerationRate.byName(
map['decelerationRate'],
),
};
instance.defaultFixedFontSize = map['defaultFixedFontSize'];
instance.defaultFontSize = map['defaultFontSize'];
instance.defaultTextEncodingName = map['defaultTextEncodingName'];
instance.disableAutocorrection = map['disableAutocorrection'];
instance.disableContextMenu = map['disableContextMenu'];
instance.disableDefaultErrorPage = map['disableDefaultErrorPage'];
instance.disableHorizontalScroll = map['disableHorizontalScroll'];
instance.disableInputAccessoryView = map['disableInputAccessoryView'];
instance.disableLongPressContextMenuOnLinks =
map['disableLongPressContextMenuOnLinks'];
instance.disableVerticalScroll = map['disableVerticalScroll'];
instance.disableWebSecurity = map['disableWebSecurity'];
instance.disallowOverScroll = map['disallowOverScroll'];
instance.displayZoomControls = map['displayZoomControls'];
instance.domStorageEnabled = map['domStorageEnabled'];
instance.drawCompositingIndicators = map['drawCompositingIndicators'];
instance.enable2DCanvasAcceleration = map['enable2DCanvasAcceleration'];
instance.enableCaretBrowsing = map['enableCaretBrowsing'];
instance.enableEncryptedMedia = map['enableEncryptedMedia'];
instance.enableJavaScriptMarkup = map['enableJavaScriptMarkup'];
instance.enableMedia = map['enableMedia'];
instance.enableMediaCapabilities = map['enableMediaCapabilities'];
instance.enableMockCaptureDevices = map['enableMockCaptureDevices'];
instance.enablePageCache = map['enablePageCache'];
instance.enableResizableTextAreas = map['enableResizableTextAreas'];
instance.enableSmoothScrolling = map['enableSmoothScrolling'];
instance.enableSpatialNavigation = map['enableSpatialNavigation'];
instance.enableTabsToLinks = map['enableTabsToLinks'];
instance.enableViewportScale = map['enableViewportScale'];
instance.enableWebRTC = map['enableWebRTC'];
instance.enableWriteConsoleMessagesToStdout =
map['enableWriteConsoleMessagesToStdout'];
instance.enterpriseAuthenticationAppLinkPolicyEnabled =
map['enterpriseAuthenticationAppLinkPolicyEnabled'];
instance.fantasyFontFamily = map['fantasyFontFamily'];
instance.fixedFontFamily = map['fixedFontFamily'];
instance.generalAutofillEnabled = map['generalAutofillEnabled'];
instance.geolocationEnabled = map['geolocationEnabled'];
instance.handleAcceleratorKeyPressed = map['handleAcceleratorKeyPressed'];
instance.hardwareAcceleration = map['hardwareAcceleration'];
instance.hiddenPdfToolbarItems = switch (enumMethod ??
EnumMethod.nativeValue) {
EnumMethod.nativeValue => PdfToolbarItems.fromNativeValue(
map['hiddenPdfToolbarItems'],
),
EnumMethod.value => PdfToolbarItems.fromValue(
map['hiddenPdfToolbarItems'],
),
EnumMethod.name => PdfToolbarItems.byName(map['hiddenPdfToolbarItems']),
};
instance.horizontalScrollBarEnabled = map['horizontalScrollBarEnabled'];
instance.ignoresViewportScaleLimits = map['ignoresViewportScaleLimits'];
instance.incognito = map['incognito'];
instance.initialScale = map['initialScale'];
instance.interceptOnlyAsyncAjaxRequests =
map['interceptOnlyAsyncAjaxRequests'];
instance.isDirectionalLockEnabled = map['isDirectionalLockEnabled'];
instance.isElementFullscreenEnabled = map['isElementFullscreenEnabled'];
instance.isFindInteractionEnabled = map['isFindInteractionEnabled'];
instance.isFraudulentWebsiteWarningEnabled =
map['isFraudulentWebsiteWarningEnabled'];
instance.isInspectable = map['isInspectable'];
instance.isPagingEnabled = map['isPagingEnabled'];
instance.isSiteSpecificQuirksModeEnabled =
map['isSiteSpecificQuirksModeEnabled'];
instance.isTextInteractionEnabled = map['isTextInteractionEnabled'];
instance.isUserInteractionEnabled = map['isUserInteractionEnabled'];
instance.itpEnabled = map['itpEnabled'];
instance.javaScriptBridgeEnabled = map['javaScriptBridgeEnabled'];
instance.javaScriptCanAccessClipboard = map['javaScriptCanAccessClipboard'];
instance.javaScriptCanOpenWindowsAutomatically =
map['javaScriptCanOpenWindowsAutomatically'];
instance.javaScriptEnabled = map['javaScriptEnabled'];
instance.limitsNavigationsToAppBoundDomains =
map['limitsNavigationsToAppBoundDomains'];
instance.loadWithOverviewMode = map['loadWithOverviewMode'];
instance.loadsImagesAutomatically = map['loadsImagesAutomatically'];
instance.maximumZoomScale = map['maximumZoomScale'];
instance.mediaPlaybackRequiresUserGesture =
map['mediaPlaybackRequiresUserGesture'];
instance.minimumLogicalFontSize = map['minimumLogicalFontSize'];
instance.minimumZoomScale = map['minimumZoomScale'];
instance.needInitialFocus = map['needInitialFocus'];
instance.nonClientRegionSupportEnabled =
map['nonClientRegionSupportEnabled'];
instance.offscreenPreRaster = map['offscreenPreRaster'];
instance.overScrollMode = switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => OverScrollMode.fromNativeValue(
map['overScrollMode'],
),
EnumMethod.value => OverScrollMode.fromValue(map['overScrollMode']),
EnumMethod.name => OverScrollMode.byName(map['overScrollMode']),
};
instance.pageZoom = map['pageZoom'];
instance.passwordAutosaveEnabled = map['passwordAutosaveEnabled'];
instance.pinchZoomEnabled = map['pinchZoomEnabled'];
instance.pluginScriptsForMainFrameOnly =
map['pluginScriptsForMainFrameOnly'];
instance.preferredContentMode = switch (enumMethod ??
EnumMethod.nativeValue) {
EnumMethod.nativeValue => UserPreferredContentMode.fromNativeValue(
map['preferredContentMode'],
),
EnumMethod.value => UserPreferredContentMode.fromValue(
map['preferredContentMode'],
),
EnumMethod.name => UserPreferredContentMode.byName(
map['preferredContentMode'],
),
};
instance.reputationCheckingRequired = map['reputationCheckingRequired'];
instance.resourceCustomSchemes = map['resourceCustomSchemes'] != null
? List<String>.from(map['resourceCustomSchemes']!.cast<String>())
: null;
instance.safeBrowsingEnabled = map['safeBrowsingEnabled'];
instance.sansSerifFontFamily = map['sansSerifFontFamily'];
instance.saveFormData = map['saveFormData'];
instance.scrollBarStyle = switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => ScrollBarStyle.fromNativeValue(
map['scrollBarStyle'],
),
EnumMethod.value => ScrollBarStyle.fromValue(map['scrollBarStyle']),
EnumMethod.name => ScrollBarStyle.byName(map['scrollBarStyle']),
};
instance.scrollMultiplier = map['scrollMultiplier'];
instance.scrollbarFadingEnabled = map['scrollbarFadingEnabled'];
instance.scrollsToTop = map['scrollsToTop'];
instance.selectionGranularity = switch (enumMethod ??
EnumMethod.nativeValue) {
EnumMethod.nativeValue => SelectionGranularity.fromNativeValue(
map['selectionGranularity'],
),
EnumMethod.value => SelectionGranularity.fromValue(
map['selectionGranularity'],
),
EnumMethod.name => SelectionGranularity.byName(
map['selectionGranularity'],
),
};
instance.serifFontFamily = map['serifFontFamily'];
instance.sharedCookiesEnabled = map['sharedCookiesEnabled'];
instance.shouldPrintBackgrounds = map['shouldPrintBackgrounds'];
instance.standardFontFamily = map['standardFontFamily'];
instance.statusBarEnabled = map['statusBarEnabled'];
instance.supportMultipleWindows = map['supportMultipleWindows'];
instance.supportZoom = map['supportZoom'];
instance.suppressesIncrementalRendering =
map['suppressesIncrementalRendering'];
instance.thirdPartyCookiesEnabled = map['thirdPartyCookiesEnabled'];
instance.transparentBackground = map['transparentBackground'];
instance.upgradeKnownHostsToHTTPS = map['upgradeKnownHostsToHTTPS'];
instance.useHybridComposition = map['useHybridComposition'];
instance.useNativeFullscreenContainer = map['useNativeFullscreenContainer'];
instance.useWideViewPort = map['useWideViewPort'];
instance.userAgent = map['userAgent'];
instance.userAgentMetadata = map['userAgentMetadata']
?.cast<String, dynamic>();
instance.verticalScrollBarEnabled = map['verticalScrollBarEnabled'];
instance.verticalScrollbarPosition = switch (enumMethod ??
EnumMethod.nativeValue) {
EnumMethod.nativeValue => VerticalScrollbarPosition.fromNativeValue(
map['verticalScrollbarPosition'],
),
EnumMethod.value => VerticalScrollbarPosition.fromValue(
map['verticalScrollbarPosition'],
),
EnumMethod.name => VerticalScrollbarPosition.byName(
map['verticalScrollbarPosition'],
),
};
return instance;
}