Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[request] add option for null handling #46

Open
nashihu opened this issue Dec 8, 2019 · 1 comment
Open

[request] add option for null handling #46

nashihu opened this issue Dec 8, 2019 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@nashihu
Copy link

nashihu commented Dec 8, 2019

hello.

thanks for your great json to dart converter. regarding request, can you create option for null handling? for example, when the input is:

{
    "nopo": "PO00000390",
    "address": "Jl. Jend Sudirman No. 1"
}

the output is:

class Autogenerated {
  String nopo;
  int quantity;

  Autogenerated({this.nopo, this.quantity});

  Autogenerated.fromJson(Map<String, dynamic> json) {
    nopo = json['nopo'] ?? "";
    quantity = json['quantity'] ?? 0;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['nopo'] = this.nopo;
    data['quantity'] = this.quantity;
    return data;
  }
}

thank you

@javiercbk javiercbk added the enhancement New feature or request label Dec 13, 2019
@javiercbk
Copy link
Owner

Hey this is a really good idea. I'll try to give this priority whenever I get my hands on this.

@javiercbk javiercbk added good first issue Good for newcomers help wanted Extra attention is needed labels Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants