provider 0.0.1

  • Installing
  • Versions
  • 90

An helper to easily exposes a value using InheritedWidget without having to write one.

This is especially useful with patterns such as BLoC or when storing our state inside InheritedWidget. As having to manually write a StatefulWidget AND an InheritedWidget can be tedious.

Usage #

Provider usage:

import 'package:provider/provider.dart';

main() {
      value: 42,
      child: Builder(
        builder: (context) => {
          // explicitly pass the generic type
          final value = Provider.of<int>(context);

          // type inference works too:
          int value2;
          value2 = Provider.of(context);

          // do something with it

StatefulProvider usage

class Model {}

class Stateless extends StatelessWidget {
  Widget build(BuildContext context) {
    return StatefulProvider(
      // we voluntary reuse the previous value
      valueBuilder: (Model old) =>  old ?? Model(),
      // child: ...,

Use this package as a library

1. Depend on it

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

  provider: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:

$ 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:

import 'package:provider/provider.dart';
Version Uploaded Documentation Archive
2.0.1 May 12, 2019 Go to the documentation of provider 2.0.1 Download provider 2.0.1 archive
2.0.0+1 May 3, 2019 Go to the documentation of provider 2.0.0+1 Download provider 2.0.0+1 archive
2.0.0 May 3, 2019 Go to the documentation of provider 2.0.0 Download provider 2.0.0 archive
1.6.1 Feb 21, 2019 Go to the documentation of provider 1.6.1 Download provider 1.6.1 archive
1.6.0 Feb 20, 2019 Go to the documentation of provider 1.6.0 Download provider 1.6.0 archive
1.5.0 Feb 11, 2019 Go to the documentation of provider 1.5.0 Download provider 1.5.0 archive
1.4.0 Feb 4, 2019 Go to the documentation of provider 1.4.0 Download provider 1.4.0 archive
1.3.0 Jan 29, 2019 Go to the documentation of provider 1.3.0 Download provider 1.3.0 archive
1.2.0 Jan 25, 2019 Go to the documentation of provider 1.2.0 Download provider 1.2.0 archive
1.1.1 Oct 22, 2018 Go to the documentation of provider 1.1.1 Download provider 1.1.1 archive

All 14 versions...

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 May 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.0
  • pana: 0.12.15
  • Flutter: 1.5.8


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance issues and suggestions

Provide a file named (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and provider.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.

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 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies