Skip to content

Releases: passsy/deep_pick

v1.1.0

30 Aug 10:24
Compare
Choose a tag to compare
  • Allow .letOrNull((pick) => null) to return null without manually setting a nullable type #61
  • CI 2024 update

v1.0.0

19 Mar 21:10
Compare
Choose a tag to compare
  • Remove long deprecated methods: addContext, asBool, asDateTime, asDouble, asInt, asList, asMap, asString. Use their as*OrThrow replacements.
  • Add support for timezones in asDateTime* methods #47, #51
  • Add official support for date formats RFC 3339, RFC 2822 and RFC 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

01 Nov 19:36
Compare
Choose a tag to compare
  • New: Support for more date formats. asDateTime* received an optional format parameter. By default, all possible formats will be parsed. To the existing ISO 8601 format, RFC 1123, RFC 850 and asctime have been added which are typically used for the HTTP header or cookies.
  • Documentation added for asDouble and asMap

v0.9.0

02 Aug 11:30
Compare
Choose a tag to compare
  • New: pickFromJson(json, args...) allows parsing of a json String, without manually calling jsonDecode #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 #38

    pick(["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 new roundDouble or truncateDouble parameters is true #37. Thx @stevendz

  • Add dartdoc to asList*() extensions

v0.8.0

14 Feb 18:41
Compare
Choose a tag to compare
  • 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 with Object where possible
  • Rename Pick.location() to Pick.debugParsingExit
  • Removal of PickLocaiton and PickContext mixins. They are now part of Pick
  • RequiredPick now extends Pick 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

14 Feb 18:40
Compare
Choose a tag to compare

Backports 0.8.0 to pre-nullsafety

v0.7.0

12 Feb 12:46
Compare
Choose a tag to compare

Enable nullsafety (requires Dart >=2.12)

v0.6.0-nullsafety.2

09 Feb 12:12
Compare
Choose a tag to compare
  • Breaking asList*() methods now ignore null values. The map function now receives a RequiredPick as fist parameter instead of a Pick making parsing easier.

    Therefore pick().required().asList((RequiredPick pick) => /*...*/) only maps non-nullable values. When your lists contain null 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 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.

  • 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 a RequiredPick back to a Pick with potential null value

  • New PickLocation.followablePath. While PickLocation.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

06 Dec 02:20
Compare
Choose a tag to compare
  • New asXyzOrThrow() methods as shorthand for .required().asXyz() featuring better error messages
    • asBoolOrThrow()
    • asDateTimeOrThrow()
    • asDoubleOrThrow()
    • asIntOrThrow()
    • letOrThrow()
    • asListOrThrow()
    • asMapOrThrow()
    • asStringOrThrow()
  • New Pick.isAbsent getter to check if a value is absent or null #24. Absent could mean
    1. Accessing a key which doesn't exist in a Map
    2. Reading the value from List when the index is greater than the length
    3. Trying to access a key in a Map but the found data a Object which isn't a Map
  • The String "true" and "false" are now parsed as boolean
  • More nnbd refactoring

0.6.0-nullsafety.0

06 Dec 01:52
Compare
Choose a tag to compare
  • Migrate to nullsafety (required Dart >=2.12)
  • Remove deprecated long deprecated parseJsonTo* methods. Use the pick(json, args*) api
  • Improve dartdoc