fluttercommunity / fluttercommunity/redux.dart

Best way to open a dialog

Open
#79 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
519
Forks
57
PR merge metrics
No merged PRs in 30d

Description

I'm wondering what is the best way to open a dialog?

My scenario:

In the middleware, I'm doing some async backend tasks. Depending on the result, I want to open a dialog to display an error message or to indicate that the user needs to log in again.

When the async task completes, I send another action to change the status, such as `showErrorDialog = true`.
In the UI code, I listen for this status (using https://github.com/brianegan/reselect_dart) and when it becomes `true`, I open the dialog and set this status to `false` (so it will not be reopened).

It works, but it also looks wrong to me.

Is there a better way to open a dialog only when an action is triggered?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.