-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from mcmah309/new_option
3.0.0
- Loading branch information
Showing
96 changed files
with
4,818 additions
and
2,314 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
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 |
---|---|---|
@@ -1,19 +1 @@ | ||
# Convert | ||
*** | ||
## Infallible | ||
|
||
`Infallible` is the error type for errors that can never happen. This can be useful for generic APIs that use Result | ||
and parameterize the error type, to indicate that the result is always Ok. Thus these types expose `intoOk` and | ||
`intoErr`. | ||
|
||
```dart | ||
Result<int, Infallible> x = Ok(1); | ||
expect(x.intoOk(), 1); | ||
Result<Infallible, int> w = Err(1); | ||
expect(w.intoErr(), 1); | ||
``` | ||
|
||
``` | ||
typedef Infallible = Never; | ||
``` |
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,17 @@ | ||
# Env | ||
|
||
Env introduces `Env` for handling the environment. It works like `Platform`, | ||
except it is cross-platform (also works on web), since it is independent of `dart:io`, and has additional methods. | ||
|
||
```dart | ||
void main(){ | ||
if(Env.isWeb) { | ||
print("On web, doing nothing."); | ||
} | ||
else if(Env.isLinux || Env.isMacOs) { | ||
Env.currentDirectory = "/"; | ||
print("Moved current directory to root"); | ||
} | ||
... | ||
} | ||
``` |
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,21 @@ | ||
# Fs | ||
|
||
Fs introduces `Fs`, a container of static methods for working with the file system in a safe manner. | ||
`Fs` combines many of the functionalities in `File`/`Directory`/`Link`/`FileStat`/`FileSystemEntity` | ||
into one location and will never throw an exception. Instead of using instances of the previous | ||
entities, `Fs` works only on paths. | ||
|
||
```dart | ||
Result<(), IoError> = await Fs.createDir("path/to/dir".asPath()); | ||
// handle | ||
``` | ||
rather than | ||
```dart | ||
try { | ||
await Directory("path/to/dir").create(); | ||
} | ||
catch (e) { | ||
// handle | ||
} | ||
// handle | ||
``` |
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
Oops, something went wrong.