range_type 0.0.2 copy "range_type: ^0.0.2" to clipboard
range_type: ^0.0.2 copied to clipboard

outdated

The convenient pure Dart library of ranges representation. Range types are data types representing a range of values of some element type.

example/range_type_example.dart

import 'package:range_type/predefined_ranges.dart';

void main() {
  final july = DateTimeRange.parse('[2022-07-01, 2022-08-01)');

  final scheduleDate1 = DateTime(2022, 07, 02);
  final scheduleDate2 = DateTime(2022, 08, 07);

  final workingDays = DateTimeRange.parse('[2022-07-20, 2022-08-15)');

  print('Is scheduleDate1 in July? ${july.containsElement(scheduleDate1)}');
  print('Is scheduleDate2 in July? ${july.containsElement(scheduleDate2)}');
  print('Is workingDays overlaps? ${july.overlap(workingDays)}');
  print('workingDays intersection: ${july.intersection(workingDays)}');
  print('workingDays union: ${july.union(workingDays)}');
  print('july difference workingDays: ${july.difference(workingDays)}');
}
6
likes
0
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

The convenient pure Dart library of ranges representation. Range types are data types representing a range of values of some element type.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on range_type