injectCSSFileFromAsset method

Future<void> injectCSSFileFromAsset({
  1. required String assetFilePath,
})

Injects a CSS file into the WebView from the flutter assets directory.

NOTE: This method shouldn't be called in the PlatformWebViewCreationParams.onWebViewCreated or PlatformWebViewCreationParams.onLoadStart events, because, in these events, the WebView is not ready to handle it yet. Instead, you should call this method, for example, inside the PlatformWebViewCreationParams.onLoadStop event or in any other events where you know the page is ready "enough".

NOTE for Web: this method will have effect only if the iframe has the same origin.

Officially Supported Platforms/Implementations:

  • Android native WebView
  • iOS
  • MacOS
  • Web

Implementation

Future<void> injectCSSFileFromAsset({required String assetFilePath}) {
  throw UnimplementedError(
      'injectCSSFileFromAsset is not implemented on the current platform');
}