json_parse_model

Last updated:

0 purchases

json_parse_model Image
json_parse_model Images
Add to Cart

Description:

json parse model

A package for convert from json to model by http api

Features #
A package for convert from json to model by http api

Getting started #
Install #
flutter pub add json_parse_model -d
flutter pub add build_runner -d
copied to clipboard
1. Add json2model.yaml to root path, the file format like below #
host: <host>
token: <token>
copied to clipboard
example:
host: http://www.baidu.com/api
token: xxxlxlxlxlx.lxlxlxl.xlxlx.xlxlxlxlx
copied to clipboard
2. Add json file to assets/json/xxx.json, the format like below #
{
"api": "<your api path>",
"outpath": "lib/json2model_gen/<model_file_name>.dart",
"className": "<modelName>"
}
copied to clipboard
example:
{
"api": "/api/v1/healing",
"outpath": "lib/json2model_gen/healing.dart",
"className": "Healing"
}
copied to clipboard
Run build to generate json model. #
1. Used as Package #
if you add json2model.yaml to root path. then add host: <api host address> and token: <request authenticate token> for http request.
run below command.
dart run build_runner build
copied to clipboard
if you don't add json2model.yaml run below command.
dart run build_runner build -d --define json_parse_model:json=host=<api host address> --define json_parse_model:json=token=<request authenticate token>
copied to clipboard
2. Used as Global Command line #
Activate Command line #
dart pub global activate json_parse_model
copied to clipboard
if you add json2model.yaml to root path. then add host: <api host address> and token: <request authenticate token> for http request.
run below command.
json build
copied to clipboard
if you don't add json2model.yaml run below command.
json build -o <api host address> -t <request authenticate token>
copied to clipboard
Usage #
if you have download the repository at locat. as command line just run below command to global command.
dart pub global activate --source path <package path>
copied to clipboard
removed command line
dart pub global deactivate json_parse_model
copied to clipboard
Additional information #
A package for convert from json to model by http api

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.