jsonut 0.2.0 copy "jsonut: ^0.2.0" to clipboard
jsonut: ^0.2.0 copied to clipboard

A minimal utility kit for working with JSON in a typesafe manner.

0.2.0 #

  • Added .as and .asOrNull methods to JsonAny for inference casting:

    final class Employee {
      const Employee({required this.name});
      final String name;
    }
    
    final object = JsonObject.parse('{"name": "John Doe"}');
    final employee = Employee(name: object['name'].as());
    
  • Breaking change: <JsonAny>.{type}Or renamed to <JsonAny>.{type}OrNull to better reflect the behavior of the method, and be idiomatic with other Dart APIs:

    - print(any.stringOr('name'));
    + print(any.stringOrNull('name'));
    
  • Breaking change: <JsonType>.parse only throws a FormatException if the input is not valid JSON, and an ArgumentError if the input is not the expected type. This makes the behavior more consistent with other Dart APIs.

  • Breaking change: Reduced the API of JsonObject to remove .{type}() methods in favor of just providing a custom [] operator tht returns JsonAny instances.

    - print(person.string('name'));
    + print(person['name'].string());
    

    Saving roughly ~2 characters per call wasn't worth the additional complexity.

0.1.0 #

  • Initial development release.
10
likes
0
pub points
34%
popularity

Publisher

verified publisherlurey.dev

A minimal utility kit for working with JSON in a typesafe manner.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on jsonut