import 'package:intl/intl.dart'; class DateRange { DateRange({required this.start, required this.end}); final DateTime? start; final DateTime? end; @override String toString() { final DateFormat dateFormat = DateFormat("MMM yyyy"); if (start == null && end == null) { return ''; } if (start == null && end != null) { return dateFormat.format(end!); } if (start != null && end == null) { return "${dateFormat.format(start!)} - Current"; } return "${dateFormat.format(start!)} - ${dateFormat.format(end!)}"; } @override int get hashCode { return Object.hashAll([start, end]); } @override bool operator ==(Object other) { return super.hashCode == other.hashCode; } }