onShowFileChooser property

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebChromeClient.onShowFileChooser', apiUrl: 'https://developer.android.com/reference/android/webkit/WebChromeClient#onShowFileChooser(android.webkit.WebView,%20android.webkit.ValueCallback%3Candroid.net.Uri[]%3E,%20android.webkit.WebChromeClient.FileChooserParams)'), LinuxPlatform(apiName: 'WebKitWebView::run-file-chooser', apiUrl: 'https://webkitgtk.org/reference/webkit2gtk/stable/signal.WebView.run-file-chooser.html')])
FutureOr<ShowFileChooserResponse?> Function(T controller, ShowFileChooserRequest request)? onShowFileChooser
final

Tell the client to show a file chooser. This is called to handle HTML forms with 'file' input type, in response to the user pressing the "Select File" button. To cancel the request, return a ShowFileChooserResponse with ShowFileChooserResponse.filePaths to null.

Note that the WebView does not enforce any restrictions on the chosen file(s). WebView can access all files that your app can access. In case the file(s) are chosen through an untrusted source such as a third-party app, it is your own app's responsibility to check what the returned Uris refer to.

Officially Supported Platforms/Implementations:

Parameters - Officially Supported Platforms/Implementations:

  • request: all platforms

Use the PlatformWebViewCreationParams.isPropertySupported method to check if this property is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      apiName: 'WebChromeClient.onShowFileChooser',
      apiUrl:
          'https://developer.android.com/reference/android/webkit/WebChromeClient#onShowFileChooser(android.webkit.WebView,%20android.webkit.ValueCallback%3Candroid.net.Uri[]%3E,%20android.webkit.WebChromeClient.FileChooserParams)',
    ),
    LinuxPlatform(
      apiName: 'WebKitWebView::run-file-chooser',
      apiUrl:
          'https://webkitgtk.org/reference/webkit2gtk/stable/signal.WebView.run-file-chooser.html',
    ),
  ],
)
final FutureOr<ShowFileChooserResponse?> Function(
  T controller,
  ShowFileChooserRequest request,
)?
onShowFileChooser;