clearFocus method

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'ViewGroup.clearFocus', apiUrl: 'https://developer.android.com/reference/android/view/ViewGroup#clearFocus()'), IOSPlatform(apiName: 'UIResponder.resignFirstResponder', apiUrl: 'https://developer.apple.com/documentation/uikit/uiresponder/1621097-resignfirstresponder'), MacOSPlatform(apiName: 'NSWindow.makeFirstResponder', apiUrl: 'https://developer.apple.com/documentation/appkit/nswindow/1419366-makefirstresponder'), LinuxPlatform(apiName: 'wpe_view_backend_remove_activity_state', apiUrl: 'https://wpewebkit.org/reference/stable/wpe-platform-2.0/func.view_backend_remove_activity_state.html', note: 'Removes focused state from WPE backend and blurs active element via JavaScript')])
Future<void> clearFocus()

Clears the current focus. On iOS and Android native WebView, it will clear also, for example, the current text selection.

Officially Supported Platforms/Implementations:

Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      apiName: 'ViewGroup.clearFocus',
      apiUrl:
          'https://developer.android.com/reference/android/view/ViewGroup#clearFocus()',
    ),
    IOSPlatform(
      apiName: 'UIResponder.resignFirstResponder',
      apiUrl:
          'https://developer.apple.com/documentation/uikit/uiresponder/1621097-resignfirstresponder',
    ),
    MacOSPlatform(
      apiName: 'NSWindow.makeFirstResponder',
      apiUrl:
          'https://developer.apple.com/documentation/appkit/nswindow/1419366-makefirstresponder',
    ),
    LinuxPlatform(
      apiName: 'wpe_view_backend_remove_activity_state',
      apiUrl:
          'https://wpewebkit.org/reference/stable/wpe-platform-2.0/func.view_backend_remove_activity_state.html',
      note:
          'Removes focused state from WPE backend and blurs active element via JavaScript',
    ),
  ],
)
Future<void> clearFocus() {
  throw UnimplementedError(
    '${PlatformInAppWebViewControllerMethod.clearFocus.name} is not implemented on the current platform',
  );
}