Releases: passsy/deep_pick
v1.1.0
v1.0.0
- Remove long deprecated methods:
addContext
,asBool
,asDateTime
,asDouble
,asInt
,asList
,asMap
,asString
. Use theiras*OrThrow
replacements. - Add support for timezones in
asDateTime*
methods #47, #51 - Add official support for date formats
RFC 3339
,RFC 2822
andRFC 1036
- Push test coverage to 100% 🤘
BREAKING CHANGES
├─┬ Class Pick
│ └── Field "addContext" removed (CF01)
├─┬ Class RequiredPick
│ └── Field "addContext" removed (CF01)
├─┬ Class BoolPick
│ └── Field "asBool" removed (CF01)
├─┬ Class NullableDateTimePick
│ └── Field "asDateTime" removed (CF01)
├─┬ Class NullableDoublePick
│ └── Field "asDouble" removed (CF01)
├─┬ Class NullableIntPick
│ └── Field "asInt" removed (CF01)
├─┬ Class NullableListPick
│ └── Method "asList" removed (CE10)
├─┬ Class NullableMapPick
│ └── Field "asMap" removed (CF01)
└─┬ Class NullableStringPick
└── Field "asString" removed (CF01)
v0.10.0
- New: Support for more date formats.
asDateTime*
received an optionalformat
parameter. By default, all possible formats will be parsed. To the existingISO 8601
format,RFC 1123
,RFC 850
andasctime
have been added which are typically used for the HTTP header or cookies. - Documentation added for
asDouble
andasMap
v0.9.0
-
New:
pickFromJson(json, args...)
allows parsing of a json String, without manually callingjsonDecode
#41 -
New:
pickDeep(json, 'some.key.inside.the.object'.split('.'))
allows picking with a dynamic depth #40 -
Add
Pick.index
to get the element index for list items #38pick(["John", "Paul", "George", "Ringo"]).asListOrThrow((pick) { final index = pick.index!; return Artist(id: index, name: pick.asStringOrThrow()); );
-
Pick.asIntOrThrow()
now allows parsing of doubles when one of the newroundDouble
ortruncateDouble
parameters istrue
#37. Thx @stevendz -
Add dartdoc to
asList*()
extensions
v0.8.0
- Deprecated parsing extensions of
RequiredPick
to acknowledge that all parsers eventually causes errors.
From now on, always use.asIntOrThrow()
instead of.required().asInt()
. Only exception is.required().toString()
.
Read more in #34 - Replace
dynamic
withObject
where possible - Rename
Pick.location()
toPick.debugParsingExit
- Removal of
PickLocaiton
andPickContext
mixins. They are now part ofPick
RequiredPick
now extendsPick
making it easier to write parsers for custom types
This release is available as backport for Dart <2.12 with version 0.6.10
v0.6.10
v0.7.0
v0.6.0-nullsafety.2
-
Breaking
asList*()
methods now ignorenull
values. The map function now receives aRequiredPick
as fist parameter instead of aPick
making parsing easier.Therefore
pick().required().asList((RequiredPick pick) => /*...*/)
only maps non-nullable values. When your lists containnull
it will be ignored.
This is fine in most cases and simplifies the map function.In rare cases, where your lists contain
null
values with meaning, use the second parameterwhenNull
to map those null values.asList((pick) => Person.fromPick(pick), whenNull: (Pick it) => null)
. The function still receives aPick
which gives access to thecontext
api or thePickLocation
. But thePick
never holds any value. -
Breaking Don't parse doubles as int because the is no rounding method which satisfies all #31
-
Breaking Allow parsing of "german" doubles with
,
as decimal separator #30 -
Improve error messages with more details where parsing stopped
-
New
RequiredPick.nullable()
converting aRequiredPick
back to aPick
with potentialnull
value -
New
PickLocation.followablePath
. WhilePickLocation.path
contains the full path to the value,followablePath
contains only the part which could be followed with a non-nullable value
v0.6.0-nullsafety.1
- New
asXyzOrThrow()
methods as shorthand for.required().asXyz()
featuring better error messagesasBoolOrThrow()
asDateTimeOrThrow()
asDoubleOrThrow()
asIntOrThrow()
letOrThrow()
asListOrThrow()
asMapOrThrow()
asStringOrThrow()
- New
Pick.isAbsent
getter to check if a value is absent ornull
#24. Absent could mean- Accessing a key which doesn't exist in a
Map
- Reading the value from
List
when the index is greater than the length - Trying to access a key in a
Map
but the found data aObject
which isn't a Map
- Accessing a key which doesn't exist in a
- The String
"true"
and"false"
are now parsed as boolean - More nnbd refactoring
0.6.0-nullsafety.0
- Migrate to nullsafety (required Dart >=2.12)
- Remove deprecated long deprecated
parseJsonTo*
methods. Use thepick(json, args*)
api - Improve dartdoc