super_ranges 1.4.0 copy "super_ranges: ^1.4.0" to clipboard
super_ranges: ^1.4.0 copied to clipboard

Powerful yet intuitive Ranges for dart. Open, closed, reversed and by steps ranges.

example/main.dart

import 'package:super_ranges/super_ranges.dart';

void main() {
  for (final value in Range(0,10)) {
    print(value);
  }
  Range(3,7).forEach(print); // 3 4 5 6

  print( Range.closed(1,5).toList() ); // [1,2,3,4,5]
  print( Range.bySteps(1,5, stride: 2) ); // 1, 3, 5
  print( Range.named(start: 1, end: 6, closed: true)); // 1,2,3,4,5,6

  print( Range.closed(4,10).contains(9.6) ); // true
  print( Range(1,6) == Range.closed(1,5) ); // true
  print( Range(1,6).toString() ); // (1..<6)

  print(Range(5,0).toList());

  print(Range.closed(5,0).sum);

  print(Range.bySteps(3,3, stride: 3).sum);

  print(Range(6,2).lowerBound);
  print(Range(6,2).upperBound);
  print(Range(2,6).lowerBound);
  print(Range(2,6).upperBound);

  for (final i in Range.to(10)) {
    print(i);
  }

  for (final i in Range.toInclusive(10)) {
    print(i);
  }
}
0
likes
40
pub points
0%
popularity

Publisher

unverified uploader

Powerful yet intuitive Ranges for dart. Open, closed, reversed and by steps ranges.

Homepage
Repository (GitHub)
View/report issues

License

MIT (LICENSE)

More

Packages that depend on super_ranges