Skip to content

Error sending live update: WindowChannelException(CHANNEL_UNREGISTERED, Channel "subwindow_channel" not accessible (may be unregistered, bidirectional pair, or permission denied)) #489

Description

@woutertje99

I am unable to send an invokeMethod over a channel.
Whenever I try, the error from the title shows up.

I've ran this in a new project, this being the only dependency I use.
I have a button that runst he following code:

Future<void> _openOrUpdateSubWindow() async {
    setState(() {
      _counter++;
    });

    final payload = 'Patient Data Update #$_counter';
    final activeWindows = await WindowController.getAll();

    for (final controller in activeWindows) {
      final args = controller.arguments as String? ?? '';
      if (args.startsWith('subwindow')) {
        await controller.show();
        try {
          await _channel.invokeMethod('updateData', payload);
        } catch (e) {
          debugPrint('Error sending live update: $e');
        }
        return;
      }
    }

    final controller = await WindowController.create(
      WindowConfiguration(
        hiddenAtLaunch: false,
        arguments: 'subwindow:$payload',
      ),
    );

    await controller.show();
  }

It just doesn't update, and I get the debugPrint every single time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions