juicer 0.10.0 copy "juicer: ^0.10.0" to clipboard
juicer: ^0.10.0 copied to clipboard

outdated

Lightweight JSON serialization library for plain, mutable classes

example/main.dart

import "dart:convert";
import "package:juicer/juicer_vm.dart";
import "package:juicer/metadata.dart";

@juiced
class Party {
  String key;
  String name;
  String country;
  String city;
  @Property(name: "street_address")
  String streetAddress;
  String zip;

  @Property(ignore: true)
  String get address => "$name\n$streetAddress\n$city\n$country";
}

void main() {
  Juicer juicer = juiceClasses([Party]);
  Map asMap = juicer.encode(new Party()
    ..key = "company_1234556"
    ..name = "Random Ltd."
    ..country = "Sovereignland"
    ..city = "Capitalcity"
    ..streetAddress = "1 Main Street"
    ..zip = "11111");
  print(json.encode(asMap));
  print(juicer.decode(asMap, (_) => Party()).address);
}
4
likes
0
pub points
27%
popularity

Publisher

unverified uploader

Lightweight JSON serialization library for plain, mutable classes

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

analyzer, build, source_gen

More

Packages that depend on juicer