I am building a mobile application that includes creating a drawer to switch between screens. Assuming I have 3 screens A, B, and C, how can I make it so that when I select screen A, it only loads data for the first time, and subsequent times I open screen A, it still retains the data without reloading? Similarly for screens B and C.
Are there ways to achieve this in Flutter? I really appreciate any help.
2
Answers
You should use state management for this:
https://docs.flutter.dev/data-and-backend/state-mgmt/simple
Not sure which version of the flutter or which libs you are using for, but anyway I think you can do like this .Use AutomaticKeepAliveClientMixin
// same you will have for the B and c