-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to change [FileMode] of the download by introducing [DioF…
…ileMode]
- Loading branch information
1 parent
679a144
commit fe609eb
Showing
6 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/// {@template dio.DioFileMode} | ||
/// The file access mode when downloading the file. | ||
/// - [DioFileMode.write]: Mode for opening a file for reading and writing. | ||
/// The file is overwritten if it already exists. The file is created if it | ||
/// does not already exist | ||
/// - [DioFileMode.append]: Mode for opening a file for reading and writing | ||
/// to the end of it. The file is created if it does not already exist. | ||
/// {@endtemplate} | ||
enum DioFileMode { | ||
write, | ||
append; | ||
|
||
T map<T>({ | ||
required T Function() write, | ||
required T Function() append, | ||
}) { | ||
switch (this) { | ||
case DioFileMode.write: | ||
return write(); | ||
case DioFileMode.append: | ||
return append(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters