DateTimeUtils class final
A collection of static utility methods for performing aggregate calculations on lists of DateTime objects.
Provides convenient access via the singleton instance DateTimeUtils.i.
{@tool snippet}
final dates = [
  DateTime(2023, 10, 20),
  DateTime(2023, 10, 10),
  null, // Nulls are safely ignored.
  DateTime(2023, 10, 30),
];
final earliest = DateTimeUtils.i.first(dates);
print('Earliest date: $earliest'); // 2023-10-10
final latest = DateTimeUtils.i.last(dates);
print('Latest date: $latest'); // 2023-10-30
{@end-tool}
- Annotations
- 
    - @Deprecated('May be removed from package in the future!')
 
Properties
- hashCode → int
- 
  The hash code for this object.
  no setterinherited
- runtimeType → Type
- 
  A representation of the runtime type of the object.
  no setterinherited
Methods
- 
  avg(Iterable< DateTime?> ? dates) → DateTime?
- 
  Calculates and returns the average DateTimefrom an iterable.
- 
  first(Iterable< DateTime?> ? dates) → DateTime?
- 
  Returns the earliest (oldest) DateTimefrom an iterable.
- 
  last(Iterable< DateTime?> ? dates) → DateTime?
- 
  Returns the latest (most recent) DateTimefrom an iterable.
- 
  median(Iterable< DateTime?> ? dates) → DateTime?
- 
  Calculates and returns the median (middle) DateTimefrom an iterable.
- 
  noSuchMethod(Invocation invocation) → dynamic 
- 
  Invoked when a nonexistent method or property is accessed.
  inherited
- 
  toString() → String 
- 
  A string representation of this object.
  inherited
Operators
- 
  operator ==(Object other) → bool 
- 
  The equality operator.
  inherited
Static Properties
- i → DateTimeUtils
- 
  The singleton instance for accessing DateTime utilities.
  final