I’d like to modify
this codelab
to read and write the data (list of favorites) in a file on disk.
Saving (and reading) a file from disk is described
here.
My main difficulty is that ChangeNotifierProvider
uses a nameless
MyAppState()
(returned under create: (context) => MyAppState()
).
return ChangeNotifierProvider(
create: (context) => MyAppState(),
One thought is to make MyApp
a StatefulWidget
, and for
MyApp.build
to return FutureBuilder<MyAppState>
, but I can’t get that to fly.
An alternative is to make MyAppState
a named object, to have something for a storage class to refer to. That’s not working on my side either.
Can you make a workable suggestion?