intervals 0.2.0-beta.2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 16

intervals

Build Status

Provides the Interval and IntervalSet class, a (resp. piecewise) contiguous set of values.

If an Interval contains two values, it also contains all values between them. It may have an upper and lower bound, and those bounds may be open or closed.

An IntervalSet represents the union of zero or more non connected intervals.

Note: this package is a fork and extension of the interval package created by Sean Eagan

Usage

import 'package:intervals/intervals.dart';

void isActive(DateTime date1, DateTime date2) {
    // Date intervals
    var activeDates = new Interval<DateTime>.closed(date1, date2);
    if(activeDates.contains(new DateTime.now())) {
      print('Item is active!');
    }  
}

// View selection model
var slider = new Slider(interval: new Interval.closed(0, 100));

// Validation
class Rating {
  final int value;

  Rating(this.value) {
    if(!new Interval.closed(1, 5).contains(value)) {
      throw new ArgumentError('ratings must be between 1 and 5');
    }
  }
}

// IntervalSet
var a = new Interval.closed(0,1)
    .union(new Interval.closed(2,5))
    .diff(new Interval.closed(3,4));

0.2.0

  • new IntervalSet class
  • added isBefore and isAfter method on Intersect
  • strong mode compliant
  • added intersect and enclose method on Intersect and intersectAll constructor

0.1.0

Use this package as a library

1. Depend on it

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


dependencies:
  intervals: ^0.2.0-beta.2

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:intervals/intervals.dart';
  
Version Uploaded Documentation Archive
0.2.0-beta.2 Feb 6, 2018 Go to the documentation of intervals 0.2.0-beta.2 Download intervals 0.2.0-beta.2 archive
0.2.0-beta.1 Feb 5, 2018 Go to the documentation of intervals 0.2.0-beta.1 Download intervals 0.2.0-beta.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
16
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.

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://www.dartlang.org/dart-2#migration.

Dependencies

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