specify 1.1.0

  • README.md
  • Installing
  • Versions
  • 0

specify #

Specifications allow simple classes to encapsulate business rules in a flexible, testable, and reusable manner.

examples #

import 'package:specify/specify.dart';

class StringContains extends Specification<String> {
    final String _substring;
    bool isSatisfiedBy(String aString) => aString.contains(_substring);

class StringNotContains extends StringContains {
    StringNotContains(String aSubstring) : super(aSubstring);
    bool isSatisfiedBy(String aString) => !super.isSatisfiedBy(aString);

class StringIn extends OrSpecification<String> {
    StringIn(List<String> aWordList) : super(
        aWordList.map((String aWord) => new StringContains(aWord)).toList()

class StringNotIn extends AndSpecification<String> {
    StringNotIn(List<String> aWordList) : super(
        aWordList.map((String aWord) => new StringNotContains(aWord)).toList()

main() {
    StringIn    isWord    = new StringIn(['foo', 'bar']);
    StringNotIn isNotWord = new StringNotIn(['baz', 'zim']);


filters #

Filtering with specifications can be very powerful, especially when used with CompositeSpecification.

import 'package:specify/specify.dart';

class StringLength extends Specification<String> {
    final int _length;


    bool isSatisfiedBy(String aString) => aString.length == _length;

class LengthFilter extends Filter<String> {
    LengthFilter(int aLength) : super(new StringLength(aLength));

main() {
    LengthFilter filter = new LengthFilter(3);

    print(filter(['foo', 'bar', 'nice', 'to', 'know', 'you']));

Use this package as a library

1. Depend on it

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

  specify: ^1.1.0

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:specify/specify.dart';
Version Uploaded Documentation Archive
1.1.0 Feb 5, 2017 Go to the documentation of specify 1.1.0 Download specify 1.1.0 archive
1.0.1 Jan 21, 2017 Go to the documentation of specify 1.0.1 Download specify 1.0.1 archive
1.0.0 Jan 19, 2017 Go to the documentation of specify 1.0.0 Download specify 1.0.0 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.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.15.0 <2.0.0