const_date_time_range 1.0.0 copy "const_date_time_range: ^1.0.0" to clipboard
const_date_time_range: ^1.0.0 copied to clipboard

A drop-in replacement for Dart's DateTimRange class with const constructors.

example/const_date_time_range_example.dart

import 'package:const_date_time/const_date_time.dart';
import 'package:const_date_time_range/const_date_time_range.dart';
import 'package:flutter/material.dart' show DateTimeRange;

const start = ConstDateTime(0, 1, 2, 3, 4, 5, 6, 7);
const end = ConstDateTime(7, 6, 5, 4, 3, 2, 1, 0);
const constDateTimeRange = ConstDateTimeRange(start: start, end: end);
final dateTimeRange = DateTimeRange(start: start.dateTime, end: end.dateTime);

final ConstDateTimeRange cdtrFromDtr = dateTimeRange.toConstDateTimeRange();

void main() {
  // you can pass a ConstDateTimeRange where a DateTimeRange is expected!
  printDateRange(constDateTimeRange);
}

void printDateRange(DateTimeRange dateTimeRange) {
  print(dateTimeRange.toString());
}
1
likes
160
points
19
downloads

Publisher

verified publisherwesty92.com

Weekly Downloads

A drop-in replacement for Dart's DateTimRange class with const constructors.

Repository (GitHub)
View/report issues

Topics

#date #time #date-time #const #util

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

const_date_time, flutter

More

Packages that depend on const_date_time_range