close method

Future<void> close()

Implementation

Future<void> close() async {
  final state = stateSubject.value;

  try {
    await Future.wait<dynamic>([
      if (state is TopicSubscriptionSubscribed)
        for (final sub in state.registeredSubscriptions)
          sub.controller.close(),
      stateSubject.close(),
    ]);

    _isClosed = true;
  } catch (err, st) {
    _logger.shout('Could not cloes a topic subscription: $this', err, st);

    _isClosed = false;
  }
}