publish method

Future<void> publish(
  1. String topic,
  2. String message
)

Publish a message

Implementation

Future<void> publish(String topic, String message) async {
  try {
    if (!_container.isRegistered(PubSubHandler)) {
      throw StateError('PubSubHandler not available');
    }
    await _container.get<PubSubHandler>().publish(topic, message);
  } catch (e) {
    _logger.error('Failed to publish: $e');
    rethrow;
  }
}