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

Help: How do I make flash bar appear only once after the app is opened? #27

Closed
Tejas-MD opened this issue Jun 24, 2021 · 2 comments
Closed

Comments

@Tejas-MD
Copy link

I am not able to use initState cause I can't get access to the context there.

@sososdk
Copy link
Owner

sososdk commented Jun 24, 2021

@Tejas-MD this may work:

@override
void initState() {
  super.initState();
  WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
    if (mounted)
      showFlash(...);
  });
}

Or refer to Toast to wait for initState to complete:

class Toast extends StatefulWidget {

@Tejas-MD
Copy link
Author

Yeah will try postFrame callback. Thanks for the reply.

@sososdk sososdk closed this as completed Jun 25, 2021
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

No branches or pull requests

2 participants