-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve usage example and tests #1933
Changes from 1 commit
22e61b1
183dc83
6f14ed6
df53865
3423e5a
8d5eb65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -51,8 +51,8 @@ Future download2(Dio dio, String url, String savePath) async { | |||||||||||||||
} | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
void showDownloadProgress(received, total) { | ||||||||||||||||
void showDownloadProgress(int received, int total) { | ||||||||||||||||
if (total != -1) { | ||||||||||||||||
print((received / total * 100).toStringAsFixed(0) + '%'); | ||||||||||||||||
print('${(received / total * 100).toStringAsFixed(0)}%'); | ||||||||||||||||
} | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
- if (total < 1) return;
- final percentage = (received / total * 100).toStringAsFixed(0)
- print('$percentage%');
+ if (total <= 0) return;
+ print('percentage: ${(received / total * 100).toStringAsFixed(0)}%'); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's fine for me.
I believe that's harder to read, but since no one else complained, it seems like that's a me problem :D |
||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.