send<T> method

  1. @override
Future<T?> send<T>(
  1. NativeCommand command
)
override

Send a command to native.

Implementation

@override
Future<T?> send<T>(NativeCommand command) async {
  sentCommands.add(command);
  for (final listener in _commandListeners) {
    listener(command);
  }

  // Special handling for window.create
  if (command.service == 'window' && command.command == 'create' && _windowCreateHandler != null) {
    return _windowCreateHandler!(command) as T?;
  }

  final key = '${command.service}.${command.command}';
  return stubbedResponses[key] as T?;
}