Skip to content

Instantly share code, notes, and snippets.

@luizjacomn
Created June 10, 2019 11:34
Show Gist options
  • Save luizjacomn/cdda1133f89fb2e28799e0c50a4af99d to your computer and use it in GitHub Desktop.
Save luizjacomn/cdda1133f89fb2e28799e0c50a4af99d to your computer and use it in GitHub Desktop.
Diferença entre durations em Dart
void main() {
Duration duration = Duration(minutes: 1, seconds: 10);
int d1 = duration.inMicroseconds;
Duration duration2 = Duration(minutes: 2, seconds: 25);
int d2 = duration2.inMicroseconds;
print('$duration -> $d1');
print('$duration2 -> $d2');
int diff = d2-d1;
Duration duration3 = Duration(microseconds: diff);
print('$duration3 -> $diff');
print(duration2 - duration);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment