Skip to content

fix: Avoid throwing a StateError in AudioPlayer._completePrepared#2010

Merged
Gustl22 merged 2 commits into
bluefireteam:mainfrom
emersion:complete-prepared-state-errro
Jun 26, 2026
Merged

fix: Avoid throwing a StateError in AudioPlayer._completePrepared#2010
Gustl22 merged 2 commits into
bluefireteam:mainfrom
emersion:complete-prepared-state-errro

Conversation

@emersion

Copy link
Copy Markdown
Contributor

Description

The event stream can be closed before it gets prepared. In that case, a StateError is thrown.

Error represents a program failure that the programmer should have avoided. Switch to an Exception with a clear message instead.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, refactor:,
    docs:, chore:, test:, ci: etc).
  • I have read the Contributor Guide and followed the process outlined for submitting PRs.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation and added dartdoc comments with ///, where necessary.
  • I have updated/added relevant examples in example.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Related Issues

Fixes #2005

The event stream can be closed before it gets prepared. In that
case, a StateError is thrown.

Error represents a program failure that the programmer should have
avoided. Switch to an Exception with a clear message instead.

Closes: bluefireteam#2005

@Gustl22 Gustl22 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Gustl22 Gustl22 changed the title fix: avoid throwing a StateError in AudioPlayer._completePrepared fix: Avoid throwing a StateError in AudioPlayer._completePrepared Jun 26, 2026
@Gustl22
Gustl22 enabled auto-merge (squash) June 26, 2026 19:22
@Gustl22
Gustl22 merged commit d8a4f39 into bluefireteam:main Jun 26, 2026
81 of 84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StateError:Bad state: No element in AudioPlayer._completePrepared

2 participants