Skip to content

Commit

Permalink
doc: Update
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmah309 committed Dec 2, 2024
1 parent 3fb9e8a commit d71ee86
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions book/src/libs/option/option.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ can easily switch between the two with no runtime cost.
```dart
Option<int> option = None;
int? nullable = option.v;
int? nullable = option.v; // or `.value`
option = Option.from(nullable);
nullable = option as int?; // or
Expand Down Expand Up @@ -81,8 +81,8 @@ final preferences;
switch (fetchUserProfile()
.map((e) => "${e.name} - profile")
.andThen((e) => Some(e).zip(fetchUserPreferences()))) {
case Some(:final v):
(profile, preferences) = v;
case Some(:final value):
(profile, preferences) = value;
default:
return;
}
Expand Down Expand Up @@ -140,5 +140,5 @@ if(x == null){

#### Conclusion
If you can't decide between the two, it is recommended to use the `Option` type as the return type, since it allows
early return, chaining operations, and easy conversion to a nullable type with `.v`. But the choice is up to the developer.
early return, chaining operations, and easy conversion to a nullable type with `.v`/`.value`. But the choice is up to the developer.
You can easily use this package and never use `Option`.

0 comments on commit d71ee86

Please sign in to comment.