The web implementation of
Import the package #
To use this plugin in your Flutter Web app, simply add it as a dependency in
pubspec.yaml alongside the base
(This is only temporary: in the future we hope to make this package an
"endorsed" implementation of
shared_preferences, so that it is automatically
included in your Flutter Web app when you depend on
This is what the above means to your
... dependencies: ... shared_preferences: ^0.5.4+8 shared_preferences_web: ^0.1.0 ...
Use the plugin #
Once you have the
shared_preferences_web dependency in your pubspec, you should
be able to use
package:shared_preferences as normal.
- Make the pedantic dev_dependency explicit.
- Bump gradle version to avoid bugs with android projects
- Remove unused onMethodCall method.
- Add an android/ folder with no-op implementation to workaround https://github.com/flutter/flutter/issues/46898.
- Bump lower constraint on Flutter version.
- Add stub podspec file.
- Adds a
- Remove the deprecated
author:field from pubspec.yaml
- Require Flutter SDK 1.10.0 or greater.
- Initial release.
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: shared_preferences_web: ^0.1.2+4
2. Install it
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
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 Apr 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.7.1
- pana: 0.13.6
- Flutter: 1.12.13+hotfix.8
The package description is too short. (-11 points)
Add more detail to the
description field of
pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.
Maintain an example. (-10 points)
Create a short demo in the
example/ directory to show how to use this package.
Common filename patterns include
shared_preferences_web.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.
|Dart SDK||>=2.0.0-dev.28.0 <3.0.0|