Skip to content

Commit c5e9f62

Browse files
committed
+Update readme
1 parent 2185c8e commit c5e9f62

27 files changed

Lines changed: 29 additions & 677 deletions

CHANGELOG.md

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1 @@
1-
# Changelog
2-
3-
## [0.17.6]
4-
5-
- Released @ 7/2025 (UTC)
6-
- Update pubspec.yaml
7-
8-
## [0.17.5]
9-
10-
- Released @ 7/2025 (UTC)
11-
- Address pub.dev issues
12-
13-
## [0.17.4]
14-
15-
- Released @ 7/2025 (UTC)
16-
- Bugfixes
17-
18-
## [0.17.3]
19-
20-
- Released @ 7/2025 (UTC)
21-
- Update readme
1+
# Changelog

example/async_example/.gitignore

Lines changed: 0 additions & 28 deletions
This file was deleted.

example/async_example/analysis_options.yaml

Lines changed: 0 additions & 59 deletions
This file was deleted.

example/async_example/lib/main.dart

Lines changed: 0 additions & 83 deletions
This file was deleted.

example/async_example/pubspec.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

example/example.dart

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
import 'package:df_safer_dart/df_safer_dart.dart';
22
import 'dart:convert';
33

4+
void main() async {
5+
for (var id in [1, 2, 3, 4, 5]) {
6+
print('Processing User ID: $id');
7+
8+
// Execute the pipeline. `await value` opens the Async box.
9+
final finalResult = await getUserNotificationSound(id).value;
10+
11+
switch (finalResult) {
12+
case Ok(value: final optionSound):
13+
switch (optionSound) {
14+
// Success! The value is an Option<String>.
15+
// Now open the Option box.
16+
case Some(value: final sound):
17+
print(' -> Success: Sound setting is "$sound"\n');
18+
case None():
19+
print(' -> Success: Sound setting was not specified.\n');
20+
}
21+
case Err err:
22+
// The entire pipeline failed at some point.
23+
print(' -> Failure: An error occurred: ${err.error}\n');
24+
}
25+
}
26+
}
27+
428
typedef KeyValueMap = Map<String, dynamic>;
529

630
// A network call that can fail. Async handles both success and exceptions.
@@ -23,8 +47,7 @@ Async<String> fetchUserData(int userId) => Async(() async {
2347
});
2448

2549
// A parser that can fail. Sync automatically catches the jsonDecode exception.
26-
Sync<KeyValueMap> parseJson(String json) =>
27-
Sync(() => jsonDecode(json) as KeyValueMap);
50+
Sync<KeyValueMap> parseJson(String json) => Sync(() => jsonDecode(json) as KeyValueMap);
2851

2952
// A helper to safely extract a typed value. It cannot fail, it can only be absent,
3053
// so it returns an Option.
@@ -57,27 +80,3 @@ Async<Option<String>> getUserNotificationSound(int userId) {
5780
),
5881
);
5982
}
60-
61-
void main() async {
62-
for (var id in [1, 2, 3, 4, 5]) {
63-
print('Processing User ID: $id');
64-
65-
// Execute the pipeline. `await value` opens the Async box.
66-
final finalResult = await getUserNotificationSound(id).value;
67-
68-
switch (finalResult) {
69-
case Ok(value: final optionSound):
70-
switch (optionSound) {
71-
// Success! The value is an Option<String>.
72-
// Now open the Option box.
73-
case Some(value: final sound):
74-
print(' -> Success: Sound setting is "$sound"\n');
75-
case None():
76-
print(' -> Success: Sound setting was not specified.\n');
77-
}
78-
case Err err:
79-
// The entire pipeline failed at some point.
80-
print(' -> Failure: An error occurred: ${err.error}\n');
81-
}
82-
}
83-
}

example/flutter_exmple/.gitignore

Lines changed: 0 additions & 28 deletions
This file was deleted.

example/flutter_exmple/analysis_options.yaml

Lines changed: 0 additions & 59 deletions
This file was deleted.

example/flutter_exmple/lib/main.dart

Lines changed: 0 additions & 8 deletions
This file was deleted.

example/flutter_exmple/pubspec.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)