toVerboseString method
1h 2m 34s — verbose, good for settings/accessibility labels
Implementation
String toVerboseString({bool includeSeconds = true}) {
final abs = this.abs();
final h = abs.inHours;
final m = abs.inMinutes % 60;
final s = abs.inSeconds % 60;
final parts = <String>[
if (h > 0) '${h}h',
if (m > 0) '${m}m',
if (s > 0 && includeSeconds) '${s}s',
];
if (parts.isEmpty) return includeSeconds ? '0s' : '0m';
final body = parts.join(' ');
return isNegative ? '-$body' : body;
}