I would like to know how to fire the event on Flutter.

Asked 2 years ago, Updated 2 years ago, 446 views

After the screen transition with Flutter, I want to read the data from Firestore on the transition destination screen and display it, but I can't find the event that ignites on its own right after the screen is created.I can fire it onPressed and read it from Firestore, so I would like you to tell me which event will ignite naturally.

flutter dart

2022-09-30 22:00

1 Answers

Start with StatefulWiget:

class Youclass extensions StatefulWidget{
      @override
      State<StatefulWidget>createState()=>_Youclass();
    }
    class_Youclass extensions State<TvMain>{
    @override
    void initState() {
        Future.delayed(Duration.zero).then((_)async{
          // Load processing: Firestore, etc.
          ....
           setState((){});
        });
    @override
      Widget build (BuildContext context) {
           // return Your Wiget
       }
    }

You can add the correspondence when you switch pages like this.


2022-09-30 22:00

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.