how to handle state of the app or lifecycle in stacked or provider architecture in flutter

I am using stacked architecture in my project. Here is my code

class InfoScreen extends StatelessWidget {

  InfoViewModel viewModel;

  Widget build(BuildContext context) {
    return ViewModelBuilder<InfoViewModel>.reactive(
        builder: (context, model, child) => _buildUI(model),
        viewModelBuilder: () => InfoViewModel());

  _buildUI(InfoViewModel viewModel) {
    return Scaffold(backgroundColor: Colors.white, body: MainScreen());

I am using the Stateless widget, So I can't use the didChangeDependencies() method to know the app state.

My Question is How do I handle app state in this screen? any help or idea is appreciated. thanks in advance

Read more here:

Content Attribution

This content was originally published by Balaji Ramadoss at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: