Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no way to handle the "done" event on the stream of a StreamProvider #3563

Open
miklcct opened this issue May 21, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working needs triage

Comments

@miklcct
Copy link

miklcct commented May 21, 2024

Describe the bug
There is no way to handle the "done" event on the stream of a StreamProvider. In particular, a StreamProvider constructed using an empty stream will stuck forever in the "loading" state.

To Reproduce

final provider = StreamProvider((ref) => const Stream<int>.empty());

class MyWidget extends ConsumerWidget {
    @override
    Widget build(BuildContext context, WidgetRef ref) =>
        ref.watch(provider).when(
            data: (x) => Text(x.toString()),
            error: (e, st) => const Text('Error'),
            loading: () => const Text('Loading'),
        );
}

The widget is stuck in loading.

Expected behavior
There should be a way to find out if the AsyncValue is done.

@miklcct miklcct added bug Something isn't working needs triage labels May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants