xrange 2.0.0 copy "xrange: ^2.0.0" to clipboard
xrange: ^2.0.0 copied to clipboard

Provides classes and methods allowing to work with ranges

example/main.dart

import 'package:xrange/src/range/range.dart';
import 'package:xrange/src/range/num_range.dart';

void range() {
  final date1 = DateTime(2015);
  final date2 = DateTime(2021);
  final dates = Range<DateTime>.closed(date1, date2);

  if (dates.contains(DateTime.now())) {
    print('Hi, contemporary!');
  } else {
    print('Apparently, you are from the future!');
  }
}

void zrange() {
  final range = NumRange.closed(-10, 10);
  for (final value in range.values(step: 2)) {
    print(value); // it yields numbers from -10 to 10 with step equals 2
  }
}

void main() {
  range();
  zrange();
}
3
likes
130
pub points
55%
popularity

Publisher

unverified uploader

Provides classes and methods allowing to work with ranges

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (LICENSE)

More

Packages that depend on xrange