json2dartc

Last updated:

0 purchases

json2dartc Image
json2dartc Images
Add to Cart

Description:

json2dartc

Json 2 Dart Command line utility #
Important note #
There is already a package called json2dart so this package will be called json2dartc !

This project was made using javiercbk's json_to_dart package ! This CLI was made to directly convert JSON stuctures into Dart classes . I personally don't like build runners and json serializers so I made this for my workflow . Feel free to open issues and submit PRs .
How to use #
Install this via pub
pub global activate json2dartc
Example #
json2dartc -u https://reqres.in/api/users -m get -e data -n Example
Null safety #
To turn on null safe code generation , add the flag --null-safe , Example :
json2dartc -u https://reqres.in/api/users -m get -n Example --null-safe
Options #
-u, --api API Endpoint required to grab the json from
-e, --entry Entry point for json data structure , e.g data.data will get the nested data array/object from API response
-n, --name Name of your data class
(defaults to "AutoGenerated")
-h, --headers Headers for your API endpoint
-m, --method Method for http request , defaults to GET
(defaults to "GET")
copied to clipboard



Option
required
default
example
note




-u
true
required field
https://reqres.in/api/users



-e
false
''
data
it's used for special access in json data , e.g data.data will access nested data object within data object


-n
false
'AutoGenerated'
Example



-h
false
{}
access-token=01234,foo=bar



-m
false
GET
GET/POST




Upcoming plans #

✅ Null safety support
❌ Tool itself written with null safety
❌ Private memmbers option
❌ Option to load json from a file

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.