I want to show SnackBar pop-up once per build of a certain stateful page. This is a Flutter web project. Any help will be appreciated.

Solution 1: Sanketh B. K

i guess this is what you meant

Stafeful Widget {
    Widget build() {
       return someWIdget();

Solution 2: Yeasin Sheikh

Basically, I am using .addPostFrameCallback it will show after the frame is build.

 _showSnackBar() {
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
          .showSnackBar(SnackBar(content: Text("SnackBar")));

And place _showSnackBar() inside initState show snackeBar once.

  void initState() {

And place _showSnackBar() under build method to show snackeBar every build

  Widget build(BuildContext context) {

Solution 3: Delwinn

This is an alternative

bool snackBarShowed = false; in top-level code

I put this inside the build method

if (snackBarShowed) {
    } else {
      Future.delayed(Duration.zero, () {
            action: SnackBarAction(
              label: 'Ok',
              onPressed: () {
            backgroundColor: Colors.black87,
            content: Text(
              'Use top-left logo to move to previous screen',
              style: body.copyWith(
                color: Colors.white,
      snackBarShowed = true;