Generator to create boilerplate for shared preferences based on a provided interface.
The generated code is platform agnostic, there's an adapter interface inside the pref_gen_annotations package that can be used to inject an implementation based on the platform project.
This choice was made to give developers the ability to model persistance rapidly into packages shared between Flutter and Web apps.
Suppose the shared model package is called A and B the platform specific annotation.
- Add this package as a dev dependency to your
pref_gen_annotationsas a dependency to your
- Annotate classes with the PreferencesHolder (or the ReactivePreferencesHolder) annotation.
pub run build_runner buildto start the code generation.
- Comsume the generated code into the
B/pubspec.yamland inject from
Bthe implementation of the adapter for Flutter into the model.
- Consume the model into the views.