channel method
Open a collaboration Channel for broadcast (client→client ephemeral messages — cursors, live drag) and presence ("who's online" + their shared state). Together with subscribe (row changes) this completes the Supabase realtime triad.
final room = mortar.realtime.channel('design-42', key: userId)
..onBroadcast('cursor', (e) => draw(e.payload))
..onPresenceSync(() => render(room.presenceState()));
room.subscribe();
await room.track({'x': 0, 'y': 0});
await room.send('cursor', {'x': x, 'y': y});
key groups a user's multiple connections (tabs / devices) under one
presence identity; it defaults to the connection's random ref, so
each connection is its own presence by default.
Implementation
Channel channel(String name, {String? key}) => Channel(
_opts,
name,
key: key,
// Inject the row-change subscriber so the channel can fan
// postgres_changes in alongside broadcast/presence (mirrors the TS
// Realtime.channel wiring).
subscribeRows: subscribe,
);