Skip to content

Instantly share code, notes, and snippets.

@mernen
Created April 20, 2022 02:47
Show Gist options
  • Save mernen/e792348559e89e20fdf338aa98690cef to your computer and use it in GitHub Desktop.
Save mernen/e792348559e89e20fdf338aa98690cef to your computer and use it in GitHub Desktop.
Dart Duration.toString() demo
void main() {
// Expected: -0:00:00.000123
// Actual: 0:00:00.000123
print(Duration(microseconds: -123));
// Expected: -0:30:00.000000
// Actual: 0:30:00.000000
print(Duration(minutes: -30));
// Expected: -1:00:00.000000
// Actual: -1:00.00.00-0.0 (JS/DartPad only)
print(Duration(hours: -1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment