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.
pref_gen_annotationsas a dependency to your
pub run build_runner buildto start the code generation.
B/pubspec.yamland inject from
Bthe implementation of the adapter for Flutter into the model.
A new Flutter project.
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Add this to your package's pubspec.yaml file:
dependencies: pref_gen: ^0.0.3
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Jul 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: other
lib/generator/common.dart. (-1.49 points)
lib/generator/common.dart reported 3 hints:
line 19 col 22: This function has a return type of 'String', but doesn't end with a return statement.
line 93 col 7: Don't explicitly initialize variables to null.
line 116 col 7: Don't explicitly initialize variables to null.
Package is pre-v0.1 release. (-10 points)
While nothing is inherently wrong with versions of
0.0.*, it might mean that the author is still experimenting with the general direction of the API.
|Dart SDK||>=2.0.0-dev.68.0 <3.0.0|