Indeed, keep it ‘alive’ for the duration of your app. This implies having a StatefulWidget run for the duration of the application, and calling the Pref library’s init() function in that Widget’s initState() function. Then, when you ‘end’ your application, you’ll end that StatefulWidget and ‘clean up’ with that widget’s dispose() function. Calling the Prefs’ dispose() function inside there.

As for ‘best practices’, I too am working out how to best implement large apps with their many screens, etc. I hope to then contribute further articles in that pursuit. However, like most things in Life, it’s a process.

Written by

Freelance Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store