blurActiveElement function

void blurActiveElement()

A safe Dart wrapper for the JS interop function. It ensures the code only runs on the client-side, preventing errors during server-side rendering (SSR).

Implementation

void blurActiveElement() {
  if (kIsWeb) {
    try {
      _blurActiveElement();
    } catch (e) {
      // Log error if the JS call fails for any reason.
      print('Could not blur active element: $e');
    }
  }
}