intervals 0.2.0-beta.2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 49

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

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or 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: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

Analysis

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

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
98 / 100
Overall score:
Weighted score of the above. [more]
49
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:intervals/intervals.dart.

Suggestions

  • Package is pre-release.

    Pre-release versions should be used with caution, their API may change in breaking ways.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 6 hints.

    Run dartfmt to format lib/intervals.dart.

    Run dartfmt to format lib/src/interval.dart.

    Similar analysis of the following files failed:

    • lib/src/interval_set.dart (hint)
    • lib/src/materialized_interval_set.dart (hint)
    • lib/src/set_operations.dart (hint)
    • lib/src/util.dart (hint)
  • Maintain an example.

    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 intervals.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0
collection ^1.14.0 1.14.10
Dev dependencies
test ^0.12.30