Skip to content

Commit e892c8d

Browse files
V0.4.1 (#91)
2 parents 899b76a + dd62057 commit e892c8d

File tree

9 files changed

+198
-79
lines changed

9 files changed

+198
-79
lines changed

CHANGELOG.md

+46
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,49 @@
1+
# v0.4.1 - 25 February 2023
2+
- New methods for `Option` type (thanks to [tim-smart](https://github.com/tim-smart) 🎉)
3+
- `flatMapNullable`
4+
- `flatMapThrowable`
5+
```dart
6+
final option = Option.of(10);
7+
8+
option.flatMapNullable((a) => a + 1); /// 👈 `Some(11)`
9+
option.flatMapThrowable((a) => a + 1); /// 👈 `Some(11)`
10+
11+
option.flatMapNullable<int>((a) => null); /// 👈 `None()`
12+
option.flatMapThrowable<int>((a) => throw "fail"); /// 👈 `None()`
13+
```
14+
15+
- Improved support `fromJson` for `Option` type (thanks [again] to [tim-smart](https://github.com/tim-smart) 🎉)
16+
- Allow for decoding of **non-primitive types** (with custom `fromJson` constructors)
17+
```dart
18+
/// `fromJson` on `DateTime` with `Option` type
19+
final now = DateTime.now();
20+
Option<DateTime>.fromJson(now.toIso8601String(), (a) => DateTime.parse(a as String)); /// 👈 `Some(now)`
21+
22+
Option<DateTime>.fromJson("fail", (a) => DateTime.parse(a as String)); /// 👈 `None()`
23+
```
24+
25+
- New extension methods for `Map` (thanks [once again] to [tim-smart](https://github.com/tim-smart) 🎉)
26+
- `extract`
27+
- `extractMap`
28+
```dart
29+
final map = <String, dynamic>{'a': 1, 'b': 2, 'c': 3, 'd': 4};
30+
map.extract<int>('b'); /// 👈 `Some(2)`
31+
map.extract<String>('b'); /// 👈 `None()`, not of type `String` ⚠️
32+
33+
final map = <String, dynamic>{'a': 1};
34+
map.extractMap('a'); /// 👈 `None()`, not a `Map`
35+
36+
final map = <String, dynamic>{'a': {'b': 2} };
37+
map.extractMap('a'); /// 👈 `Some({'b': 2})`
38+
```
39+
40+
- `Option.of` and `Option.none` factories `const` (thanks to [f-person](https://github.com/f-person) 🎉)
41+
42+
> **Note**: People who have the [prefer_const_constructors](https://dart.dev/tools/linter-rules#prefer_const_constructors) lint enabled will notice a warning to use `const` 🤝
43+
44+
- New [`managing_imports`](./example/managing_imports) example (thanks to [RandalSchwartz](https://github.com/RandalSchwartz) 🎉)
45+
- Updated [README](./README.md) introduction
46+
147
# v0.4.0 - 16 December 2022
248
- Added extension methods to work with nullable types (`T?`)
349
- From `T?` to `fpdart`'s types

README.md

+27-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
# `Fpdart`
1+
<h3 align="center">
2+
<a href="https://github.com/SandroMaglione/fpdart">
3+
<img src="./example/screenshots/screenshot_fpdart.png" width="500" />
4+
</a>
5+
</h3>
6+
27

3-
<p>
8+
<p align="center">
9+
<strong>Functional programming in Dart and Flutter</strong>
10+
</p>
11+
12+
<p align="center">
13+
All the main functional programming types and patterns <strong>fully documented</strong>, tested, and with examples
14+
</p>
15+
16+
17+
<p align="center">
418
<a href="https://github.com/SandroMaglione/fpdart">
519
<img src="https://img.shields.io/github/stars/SandroMaglione/fpdart?logo=github" />
620
</a>
@@ -15,10 +29,7 @@
1529
</a>
1630
</p>
1731

18-
19-
Functional programming in Dart and Flutter.
20-
21-
All the main functional programming types and patterns **fully documented**, tested, and with examples.
32+
## Introduction
2233

2334
> **Fpdart is fully documented. You do not need to have any previous experience with functional programming to start using `fpdart`. Give it a try!**
2435
@@ -28,10 +39,15 @@ Fpdart is inspired by [fp-ts](https://gcanti.github.io/fp-ts/), [cats](https://t
2839
2940
***
3041

42+
- [Introduction](#introduction)
3143
- [📖 Learn `functional programming` and `fpdart`](#-learn-functional-programming-and-fpdart)
3244
- [👨‍💻 Blog posts and tutorials](#-blog-posts-and-tutorials)
3345
- [💻 Installation](#-installation)
3446
- [✨ Examples](#-examples)
47+
- [Pokeapi](#pokeapi)
48+
- [Open Meteo API](#open-meteo-api)
49+
- [Read/Write local file](#readwrite-local-file)
50+
- [Manage imports](#manage-imports)
3551
- [Option](#option)
3652
- [Either](#either)
3753
- [IO](#io)
@@ -84,7 +100,7 @@ Check out also this series of articles about functional programming with `fpdart
84100
```yaml
85101
# pubspec.yaml
86102
dependencies:
87-
fpdart: ^0.4.0 # Check out the latest version
103+
fpdart: ^0.4.1 # Check out the latest version
88104
```
89105
90106
## ✨ Examples
@@ -106,6 +122,9 @@ A 2 parts series explains step by step the Open Meteo API code:
106122
### [Read/Write local file](./example/read_write_file/)
107123
Example of how to read and write a local file using functional programming.
108124

125+
### [Manage imports](./example/managing_imports)
126+
Using `fpdart` with other libraries and noticing naming conflicts? Learn how to rename the classes that conflict with other SDK or third-party packages.
127+
109128
### [Option](./lib/src/option.dart)
110129
Used when a return value can be missing.
111130
> For example, when parsing a `String` to `int`, since not all `String`
@@ -336,6 +355,7 @@ In general, **any contribution or feedback is welcome** (and encouraged!).
336355

337356
## 📃 Versioning
338357

358+
- v0.4.1 - 25 February 2023
339359
- **v0.4.0** - 16 December 2022
340360
- **v0.3.0** - 11 October 2022
341361
- **v0.2.0** - 16 July 2022

example/json_serializable/pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ packages:
191191
path: "../.."
192192
relative: true
193193
source: path
194-
version: "0.4.0"
194+
version: "0.4.1"
195195
frontend_server_client:
196196
dependency: transitive
197197
description:

0 commit comments

Comments
 (0)