import 'package:flutter/material.dart'; extension TimeOfDayExtension on TimeOfDay { TimeOfDay add({int hour = 0, int minute = 0}) { return replacing(hour: this.hour + hour, minute: this.minute + minute); } int compareTo(TimeOfDay other) { if (hour < other.hour) return -1; if (hour > other.hour) return 1; if (minute < other.minute) return -1; if (minute > other.minute) return 1; return 0; } bool isBefore(TimeOfDay other) { return compareTo(other) == -1; } }