简体   繁体   中英

Does streambuilder flutter uses cache?

I'm working on a streambuilder in flutter and this one as the stream the FirebaseAuth.instance.authStateChanges(). I do have a question because I saw that the information is saved but I want to know more about it, as I don't know why if the app is closed and reopened the data is still there. How is the data saved in the StreamBuilder? I found it usefull but I need to understand what is going on image

Thank you

StreamBuilder not caching anything, instead Firebase SDK caching its own state for you automatically.

the documentation:

The Firebase SDKs for all platforms provide out of the box support for ensuring that your user's authentication state is persisted across app restarts or page reloads.

On native platforms such as Android & iOS, this behavior is not configurable and the user's authentication state will be persisted on device between app restarts. The user can clear the apps cached data using the device settings, which will wipe any existing state being stored.

remember this line first time before app running?

await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);

you are basically run all firebase core before your own app run, the magic happen there. its not configurable based on the doc.

however on web, there is different case where you can configure based on session or locally instead of IndexedDB

source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM