scoped 0.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 76

scoped

A simple scoped store allowing for quick access to global services/bloc's

Example

pubspec.yaml

dependencies:
  scoped: ^0.2.0

lib\main.dart

import 'package:scoped/di.dart';
//...

void main() => runApp(Scope(
  store:Store()
    ..add(Service('a great service')),
  child: YourApp()));

class Service {
  final String name;
  Service(this.name);
}

class YourApp extends StatelessWidget {
  Wiget build(BuildingContext context){
    return Text(Scope.get<Service>(context).name);
  }
}

with fluid models

import 'package:scoped/di.dart';
//...

void main() => runApp(Scope(
  store:Store()
    ..add(Service('a great service')),
  child: YourApp()));

class Service extends Fluid {
  String _name;
  String name;
  set name(String value){
    _name = value;
    notify();
  }
  Service({String name}):_name=name;
}

class YourApp extends StatelessWidget {
  Wiget build(BuildingContext context){
    return Column(
      children: [
        FluidBuilder<Service>(
          fluid: Scope.get<Service>(context),
          builder: (context, s) => Text(s.name)),
        FlatButton(
          child:Text("Change"),
          onPressed:() => Scope.get<Service>(context).name = 'changed')
      ]);
  }
}

[0.2.0]

added fluid

[0.1.0]

ready to use

[0.0.1]

initial release.

Use this package as a library

1. Depend on it

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


dependencies:
  scoped: ^0.2.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:scoped/di.dart';
import 'package:scoped/fluid.dart';
import 'package:scoped/scope.dart';
import 'package:scoped/store.dart';
  
Version Uploaded Documentation Archive
0.2.0 Sep 15, 2018 Go to the documentation of scoped 0.2.0 Download scoped 0.2.0 archive
0.1.2 Sep 2, 2018 Go to the documentation of scoped 0.1.2 Download scoped 0.1.2 archive
0.1.1 Aug 27, 2018 Go to the documentation of scoped 0.1.1 Download scoped 0.1.1 archive
0.1.0 Aug 27, 2018 Go to the documentation of scoped 0.1.0 Download scoped 0.1.0 archive
0.0.3 Aug 27, 2018 Go to the documentation of scoped 0.0.3 Download scoped 0.0.3 archive
0.0.2 Aug 27, 2018 Go to the documentation of scoped 0.0.2 Download scoped 0.0.2 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
57
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use scoped.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test