| Index: lib/src/utils.dart
|
| diff --git a/lib/src/utils.dart b/lib/src/utils.dart
|
| index 7d697981ffbe97dc5f9f36e2ec8923f7513cd1ae..59edb66579950c17230e135aee3e08a945c8ead9 100644
|
| --- a/lib/src/utils.dart
|
| +++ b/lib/src/utils.dart
|
| @@ -149,6 +149,25 @@ String truncate(String text, int maxLength) {
|
| return '...$result';
|
| }
|
|
|
| +/// Returns a human-friendly representation of [duration].
|
| +String niceDuration(Duration duration) {
|
| + var minutes = duration.inMinutes;
|
| + var seconds = duration.inSeconds % 59;
|
| + var decaseconds = (duration.inMilliseconds % 1000) ~/ 100;
|
| +
|
| + var buffer = new StringBuffer();
|
| + if (minutes != 0) buffer.write("$minutes minutes");
|
| +
|
| + if (minutes == 0 || seconds != 0) {
|
| + if (minutes != 0) buffer.write(", ");
|
| + buffer.write(seconds);
|
| + if (decaseconds != 0) buffer.write(".$decaseconds");
|
| + buffer.write(" seconds");
|
| + }
|
| +
|
| + return buffer.toString();
|
| +}
|
| +
|
| /// Merges [streams] into a single stream that emits events from all sources.
|
| Stream mergeStreams(Iterable<Stream> streamIter) {
|
| var streams = streamIter.toList();
|
|
|