Skip to content

Commit 3981f06

Browse files
committed
Update changelog
1 parent b48beb2 commit 3981f06

1 file changed

Lines changed: 54 additions & 34 deletions

File tree

CHANGELOG.md

Lines changed: 54 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1-
## 0.8.0 (and 0.6.10 for Dart <2.12)
1+
# Changelog
22

3-
- Deprecated parsing extensions of `RequiredPick` to acknowledge that all parsers eventually causes errors.
3+
## 0.9.0 (`02.08.21`)
4+
5+
- New: `pickFromJson(json, args...)` allows parsing of a json String, without manually calling `jsonDecode` [#41](https://github.com/passsy/deep_pick/pull/41)
6+
- New: `pickDeep(json, 'some.key.inside.the.object'.split('.'))` allows picking with a dynamic depth [#40](https://github.com/passsy/deep_pick/pull/40)
7+
- Add `Pick.index` to get the element index for list items [#38](https://github.com/passsy/deep_pick/pull/38)
8+
9+
```dart
10+
pick(["John", "Paul", "George", "Ringo"]).asListOrThrow((pick) {
11+
final index = pick.index!;
12+
return Artist(id: index, name: pick.asStringOrThrow());
13+
);
14+
```
15+
16+
- `Pick.asIntOrThrow()` now allows parsing of doubles when one of the new `roundDouble` or `truncateDouble` parameters is `true` [#37](https://github.com/passsy/deep_pick/pull/37). Thx @stevendz
17+
- Add dartdoc to `asList*()` extensions
18+
19+
## 0.8.0 (and 0.6.10 for Dart <2.12) (`12.02.21`)
20+
21+
- Deprecated parsing extensions of `RequiredPick` to acknowledge that all parsers eventually causes errors.
422
From now on, always use `.asIntOrThrow()` instead of `.required().asInt()`. Only exception is `.required().toString()`.
523
Read more in [#34](https://github.com/passsy/deep_pick/pull/34)
624
- Replace `dynamic` with `Object` where possible
@@ -19,6 +37,7 @@ Backports 0.8.0 to pre-nullsafety
1937
## 0.6.0
2038

2139
### API changes
40+
2241
- Remove long deprecated `parseJsonTo*` methods. Use the `pick(json, args*)` api
2342
- New `asXyzOrThrow()` methods as shorthand for `.required().asXyz()` featuring better error messages
2443
- `asBoolOrThrow()`
@@ -45,6 +64,7 @@ Backports 0.8.0 to pre-nullsafety
4564
In rare cases, where your lists contain `null` values with meaning, use the second parameter `whenNull` to map those null values `.asList((pick) => Person.fromPick(pick), whenNull: (Pick it) => null)`. The function still receives a `Pick` which gives access to the `context` api or the `PickLocation`. But the `Pick` never holds any value.
4665

4766
### Parsing changes
67+
4868
- The String `"true"` and `"false"` are now parsed as boolean
4969
- **Breaking** Don't parse doubles as int because the is no rounding method which satisfies all [#31](https://github.com/passsy/deep_pick/pull/31)
5070
- **Breaking** Allow parsing of "german" doubles with `,` as decimal separator [#30](https://github.com/passsy/deep_pick/pull/30)
@@ -91,6 +111,7 @@ Backports 0.8.0 to pre-nullsafety
91111
- Improve dartdoc
92112

93113
## 0.5.1
114+
94115
- Rename `Pick.addContext` to `Pick.withContext` using deprecation
95116
- `Pick.fromContext` now accepts 10 arguments for nested structures
96117
- Fix `Pick.fromContext` always returning `context` not the value for `key` in context `Map`
@@ -99,41 +120,41 @@ Backports 0.8.0 to pre-nullsafety
99120

100121
- New context API. You can now attach relevant additional information for parsing directly to the `Pick` object. This allows passing information into `fromPick` constructors without adding new parameters to all constructors in between.
101122

102-
```dart
103-
// Add context
104-
final shoes = pick(json, 'shoes')
105-
.addContext('apiVersion', "2.3.0")
106-
.addContext('lang', "en-US")
107-
.asListOrEmpty((p) => Shoe.fromPick(p.required()));
108-
```
123+
```dart
124+
// Add context
125+
final shoes = pick(json, 'shoes')
126+
.addContext('apiVersion', "2.3.0")
127+
.addContext('lang', "en-US")
128+
.asListOrEmpty((p) => Shoe.fromPick(p.required()));
129+
```
109130

110-
```dart
111-
import 'package:version/version.dart';
112-
113-
// Read context
114-
factory Shoe.fromPick(RequiredPick pick) {
115-
// read context API
116-
final version = pick.fromContext('newApi').required().let((pick) => Version(pick.asString()));
117-
return Shoe(
118-
id: pick('id').required().asString(),
119-
name: pick('name').required().asString(),
120-
// manufacturer is a required field in the new API
121-
manufacturer: version >= Version(2, 3, 0)
122-
? pick('manufacturer').required().asString()
123-
: pick('manufacturer').asStringOrNull(),
124-
tags: pick('tags').asListOrEmpty(),
125-
);
126-
}
127-
```
128-
- Breaking: `Pick` and `RequiredPick` have chained their constructor signature. `path` is now a named argument
129-
and `context` has been added.
131+
```dart
132+
import 'package:version/version.dart';
133+
134+
// Read context
135+
factory Shoe.fromPick(RequiredPick pick) {
136+
// read context API
137+
final version = pick.fromContext('newApi').required().let((pick) => Version(pick.asString()));
138+
return Shoe(
139+
id: pick('id').required().asString(),
140+
name: pick('name').required().asString(),
141+
// manufacturer is a required field in the new API
142+
manufacturer: version >= Version(2, 3, 0)
143+
? pick('manufacturer').required().asString()
144+
: pick('manufacturer').asStringOrNull(),
145+
tags: pick('tags').asListOrEmpty(),
146+
);
147+
}
148+
```
149+
150+
- Breaking: `Pick` and `RequiredPick` have chained their constructor signature. `path` is now a named argument and `context` has been added.
130151

131152
```diff
132153
- RequiredPick(this.value, [this.path = const []])
133154
+ RequiredPick(this.value, {this.path = const [], Map<String, dynamic> context})
134155
```
135156

136-
- The `path` is now correctly forwarded after `Pick#call` or `Pick#asListOrEmpty` and always shows the full path since origin
157+
- The `path` is now correctly forwarded after `Pick#call` or `Pick#asListOrEmpty` and always shows the full path since origin
137158

138159
## 0.4.3
139160

@@ -211,18 +232,18 @@ Ever got a `Pick`/`RequiredPick` and you wanted to pick even further. This is no
211232

212233
Also the lib has been converted to use static extension methods which were introduced in Dart 2.6
213234

214-
215235
## 0.3.0
216236

217237
`asMap` now expects the key type, defaults to `dynamic` instead of `String`
238+
218239
```diff
219240
-Pick.asMap(): Map<String, dynamic>
220241
+Pick.asMap<T>(): Map<T, dynamic>
221242
```
222243

223244
## 0.2.0
224245

225-
New API!
246+
New API!
226247
The old `parse*` methods are now deprecated, but still work.
227248
Replace them with the new `pick(json, arg0-9...)` method.
228249

@@ -233,7 +254,7 @@ Replace them with the new `pick(json, arg0-9...)` method.
233254

234255
`pick` returns a `Pick` which offers a rich API to parse values.
235256

236-
```
257+
```text
237258
.asString()
238259
.asStringOrNull()
239260
.asMap()
@@ -254,7 +275,6 @@ Replace them with the new `pick(json, arg0-9...)` method.
254275
.asDateTimeOrNull()
255276
```
256277

257-
258278
## 0.1.1
259279

260280
- pubspec description updated

0 commit comments

Comments
 (0)