numeric_range 1.1.0 copy "numeric_range: ^1.1.0" to clipboard
numeric_range: ^1.1.0 copied to clipboard

Utility methods for integer intervals.

Numeric range #

Lightweight utility class providing interval-like operations as implemented e.g. also by math_expressions. This package offers a type-safe int-only version though, as well as exposing a dedicated API for intersecting ranges.

/// create an instance - for integer-only operations, import from [integer_range.dart]
const fourToFive = Range(4, 5);

/// in-range check
fourToFive.contains(4); // true
fourToFive.contains(7); // false

/// intersecting
fourToFive.intersection(Range(3.9, 5.1)); // still [4..5]
/// shorthand notation for intersection
fourToFive & NumRange(3.9, 4.9); // [4..4.9]

/// equality 
Range(4, 8).intersection(Range(3, 6)) == Range(4, 6); // true
0
likes
140
points
851
downloads

Publisher

unverified uploader

Weekly Downloads

Utility methods for integer intervals.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

meta

More

Packages that depend on numeric_range