pretty_duration 1.0.1
pretty_duration: ^1.0.1 copied to clipboard
Formats a Duration into a readable string with short or verbose output, automatically skipping zero-value units for clean and concise display.
example/pretty_duration_example.dart
import 'package:pretty_duration/pretty_duration.dart';
void main() {
final d = Duration(days: 1, hours: 2, minutes: 5, seconds: 0);
print(prettyDuration(d));
// "1d 2h 5m 0s"
print(prettyDuration(d, skipEmpty: true));
// "1d 2h 5m"
print(prettyDuration(d, verbose: true));
// "1 day 2 hours 5 minutes 0 seconds"
}