-
Notifications
You must be signed in to change notification settings - Fork 133
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
Transfer Funds in progress dialog state management #1234
Transfer Funds in progress dialog state management #1234
Conversation
if (state.transferringOnChainDeposit != true) { | ||
_pop(); | ||
if (state.transferringOnChainDeposit != true && _currentRoute.isActive) { | ||
Navigator.of(context).removeRoute(_currentRoute); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you can access build context in initState.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not accessed in initState
per se but after subscription to a stream has established, we're also checking if _currentRoute.isActive
beforehand.
It's not really needed on this example but what we can do to make things more robust is scheduling the stream subscription logic once the context is available as such:
WidgetsBinding.instance.addPostFrameCallback((_) {
/// Stream Subscription Logic
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we wish to do this in the initstate
instead of calling this in didChangeDependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to subscribe to the stream only once and didChangeDependencies
may be called multiple times per widget lifecycle. We'd need some preventative measures in didChangeDependencies
, we do have some examples using _isInit
variable on breezmobile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks for clarifying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand. But I have no objections. LGTM!
Can we merge that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT
This PR addresses #1232
Instead of popping the last item on navigation stack, the route(dialog) itself is removed if it's active.