pref_gen 0.0.3

  • Example
  • Installing
  • Versions
  • 48

pref_gen #

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.

Usage #

Suppose the shared model package is called A and B the platform specific annotation.

  1. Add this package as a dev dependency to your A/pubspec.yaml.
  2. Add pref_gen_annotations as a dependency to your A/pubspec.yaml
  3. Annotate classes with the PreferencesHolder (or the ReactivePreferencesHolder) annotation.
  4. Run pub run build_runner build to start the code generation.
  5. Comsume the generated code into the A package.
  6. Add pref_gen_flutter in B/pubspec.yaml and inject from B the implementation of the adapter for Flutter into the model.
  7. Consume the model into the views.

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.


Example #

A new Flutter project.

Getting Started #

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.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  pref_gen: ^0.0.3

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:pref_gen/pref_gen.dart';
Version Uploaded Documentation Archive
0.0.3 Dec 31, 2018 Go to the documentation of pref_gen 0.0.3 Download pref_gen 0.0.3 archive
0.0.2 Dec 31, 2018 Go to the documentation of pref_gen 0.0.2 Download pref_gen 0.0.2 archive
0.0.1 Dec 30, 2018 Go to the documentation of pref_gen 0.0.1 Download pref_gen 0.0.1 archive
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]
Learn more about scoring.

We analyzed this package on Apr 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14


Detected platforms: other

Primary library: package:pref_gen/pref_gen.dart with components: io, build, mirrors.

Health suggestions

Fix lib/generator/common.dart. (-1 points)

Analysis of lib/generator/common.dart reported 2 hints:

line 93 col 7: Don't explicitly initialize variables to null.

line 116 col 7: Don't explicitly initialize variables to null.

Maintenance suggestions

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.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
build ^1.0.2 1.1.3
build_runner ^1.1.2 1.3.3
code_builder ^3.1.3 3.2.0
pref_gen_annotations ^0.0.1 0.0.2
source_gen ^0.9.3 0.9.4+2
Transitive dependencies
analyzer 0.36.1
args 1.5.1
async 2.2.0
build_config 0.3.2
build_daemon 0.5.0
build_resolvers 1.0.4
build_runner_core 3.0.3
built_collection 4.2.0
built_value 6.4.0
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
csslib 0.15.0
dart_style 1.2.7
fixnum 0.10.9
front_end 0.1.16
glob 1.1.7
graphs 0.2.0
html 0.14.0+1
http 0.12.0+2
http_multi_server 2.0.5
http_parser 3.1.3
io 0.3.3
js 0.6.1+1
json_annotation 2.2.0
kernel 0.3.16
logging 0.11.3+2
matcher 0.12.5
meta 1.1.7
mime 0.9.6+2
package_config 1.0.5
package_resolver 1.0.10
path 1.6.2
pedantic 1.5.0
pool 1.4.0
pub_semver 1.4.2
pubspec_parse 0.1.4
quiver 2.0.3
shelf 0.7.5
shelf_web_socket 0.2.3
source_span 1.5.5
stack_trace 1.9.3
stream_channel 2.0.0
stream_transform 0.0.17
string_scanner 1.0.4
term_glyph 1.1.0
timing 0.1.1+1
typed_data 1.1.6
watcher 0.9.7+10
web_socket_channel 1.0.12
yaml 2.1.15