Google is committed to advancing racial equity for Black communities. See how.

requestFocus method

*<Null safety>*

Future<void> requestFocus ()

Requests that focus be transferred to the remote Scene represented by this connection.


Future<void> requestFocus() async {
  assert(viewRef != null);
  final args = <String, dynamic>{
    'viewRef': viewRef!.reference.handle!.handle
  final result =
      await _platformViewChannel.invokeMethod('View.requestFocus', args);
  // Throw OSError if result is non-zero.
  if (result != 0) {
    final koid = viewRef!.reference.handle!.koid;
    final error = Error(result);
    throw OSError(
      'Failed to request focus for view: $koid with $error',