closeDialog method

void closeDialog()

Implementation

void closeDialog() {
  // Ensure we stop any active stream when closing the overlay
  if (_isStreaming) {
    _stopStreaming();
  }
  // Stop audio playback as well
  () async {
    try {
      await _audioPlayer.stop();
    } catch (_) {}
  }();
  if (overlayEntry?.mounted == true) {
    overlayEntry?.remove();
  }
  overlayEntry = null;
}