dispatch method

Future<void> dispatch(
  1. FloatyAction action
)

Dispatches an action to the other side, queueing it on the overlay side while the main app is disconnected.

Implementation

Future<void> dispatch(FloatyAction action) {
  if (_isOverlay && !FloatyConnectionState.isMainAppConnected) {
    _queue.add(action);
    return Future<void>.value();
  }
  return FloatyChannel.sendSystem(_prefix, {
    'type': action.type,
    'payload': action.toJson(),
  });
}