Skip to content

Commit eb09c60

Browse files
committed
package publish
1 parent 9f1dd9f commit eb09c60

File tree

5 files changed

+45
-33
lines changed

5 files changed

+45
-33
lines changed

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
## Json 2 Dart Command line utility
22

3+
## Important note
4+
5+
There is already a package called `json2dart` so this package will be called `json2dartc` !
6+
37
<img src="./media/example.gif" width="600">
48

59
This project was made using [javiercbk's json_to_dart package](https://github.com/javiercbk/json_to_dart) ! 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 .
610

711
## How to use
812

9-
Download the project and in `/build` foolder we have excutables for windows and linux / darwin systems . Add this folder to system PATH . Then in your terminal
13+
Install this via `pub`
14+
15+
`pub global activate json2dartc`
16+
17+
## Example
1018

11-
`json2dart -u https://reqres.in/api/users -m get -e data -n Example`
19+
`json2dartc -u https://reqres.in/api/users -m get -e data -n Example`
1220

1321
## Null safety
1422

1523
To turn on null safe code generation , add the flag `--null-safe` , Example :
1624

17-
`json2dart -u https://reqres.in/api/users -m get -n Example --null-safe`
25+
`json2dartc -u https://reqres.in/api/users -m get -n Example --null-safe`
1826

1927
## Options
2028

@@ -39,5 +47,6 @@ To turn on null safe code generation , add the flag `--null-safe` , Example :
3947
## Upcoming plans
4048

4149
- [x] Null safety support
50+
- [ ] Tool itself written with null safety
4251
- [ ] Private memmbers option
4352
- [ ] Option to load json from a file

bin/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dart compile exe ./json2dart.dart -o ../build/json2dart && dart compile exe ./json2dart.dart -o ../build/json2dart.exe
1+
dart compile exe ./json2dartc.dart -o ../build/json2dartc && dart compile exe ./json2dartc.dart -o ../build/json2dartc.exe
File renamed without changes.

pubspec.lock

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,189 +5,189 @@ packages:
55
dependency: transitive
66
description:
77
name: _fe_analyzer_shared
8-
url: "https://pub.flutter-io.cn"
8+
url: "https://pub.dartlang.org"
99
source: hosted
1010
version: "22.0.0"
1111
analyzer:
1212
dependency: transitive
1313
description:
1414
name: analyzer
15-
url: "https://pub.flutter-io.cn"
15+
url: "https://pub.dartlang.org"
1616
source: hosted
1717
version: "1.7.2"
1818
args:
1919
dependency: "direct main"
2020
description:
2121
name: args
22-
url: "https://pub.flutter-io.cn"
22+
url: "https://pub.dartlang.org"
2323
source: hosted
2424
version: "2.2.0"
2525
async:
2626
dependency: transitive
2727
description:
2828
name: async
29-
url: "https://pub.flutter-io.cn"
29+
url: "https://pub.dartlang.org"
3030
source: hosted
3131
version: "2.8.1"
3232
charcode:
3333
dependency: transitive
3434
description:
3535
name: charcode
36-
url: "https://pub.flutter-io.cn"
36+
url: "https://pub.dartlang.org"
3737
source: hosted
3838
version: "1.3.1"
3939
cli_util:
4040
dependency: transitive
4141
description:
4242
name: cli_util
43-
url: "https://pub.flutter-io.cn"
43+
url: "https://pub.dartlang.org"
4444
source: hosted
4545
version: "0.3.3"
4646
collection:
4747
dependency: transitive
4848
description:
4949
name: collection
50-
url: "https://pub.flutter-io.cn"
50+
url: "https://pub.dartlang.org"
5151
source: hosted
5252
version: "1.15.0"
5353
convert:
5454
dependency: transitive
5555
description:
5656
name: convert
57-
url: "https://pub.flutter-io.cn"
57+
url: "https://pub.dartlang.org"
5858
source: hosted
5959
version: "3.0.1"
6060
crypto:
6161
dependency: transitive
6262
description:
6363
name: crypto
64-
url: "https://pub.flutter-io.cn"
64+
url: "https://pub.dartlang.org"
6565
source: hosted
6666
version: "3.0.1"
6767
dart_style:
6868
dependency: "direct main"
6969
description:
7070
name: dart_style
71-
url: "https://pub.flutter-io.cn"
71+
url: "https://pub.dartlang.org"
7272
source: hosted
7373
version: "1.3.14"
7474
file:
7575
dependency: transitive
7676
description:
7777
name: file
78-
url: "https://pub.flutter-io.cn"
78+
url: "https://pub.dartlang.org"
7979
source: hosted
8080
version: "6.1.2"
8181
glob:
8282
dependency: transitive
8383
description:
8484
name: glob
85-
url: "https://pub.flutter-io.cn"
85+
url: "https://pub.dartlang.org"
8686
source: hosted
8787
version: "2.0.1"
8888
grapheme_splitter:
8989
dependency: transitive
9090
description:
9191
name: grapheme_splitter
92-
url: "https://pub.flutter-io.cn"
92+
url: "https://pub.dartlang.org"
9393
source: hosted
9494
version: "1.0.0"
9595
http:
9696
dependency: "direct main"
9797
description:
9898
name: http
99-
url: "https://pub.flutter-io.cn"
99+
url: "https://pub.dartlang.org"
100100
source: hosted
101101
version: "0.13.3"
102102
http_parser:
103103
dependency: transitive
104104
description:
105105
name: http_parser
106-
url: "https://pub.flutter-io.cn"
106+
url: "https://pub.dartlang.org"
107107
source: hosted
108108
version: "4.0.0"
109109
json_ast:
110110
dependency: "direct main"
111111
description:
112112
name: json_ast
113-
url: "https://pub.flutter-io.cn"
113+
url: "https://pub.dartlang.org"
114114
source: hosted
115115
version: "1.0.5"
116116
meta:
117117
dependency: transitive
118118
description:
119119
name: meta
120-
url: "https://pub.flutter-io.cn"
120+
url: "https://pub.dartlang.org"
121121
source: hosted
122122
version: "1.7.0"
123123
package_config:
124124
dependency: transitive
125125
description:
126126
name: package_config
127-
url: "https://pub.flutter-io.cn"
127+
url: "https://pub.dartlang.org"
128128
source: hosted
129129
version: "2.0.0"
130130
path:
131131
dependency: transitive
132132
description:
133133
name: path
134-
url: "https://pub.flutter-io.cn"
134+
url: "https://pub.dartlang.org"
135135
source: hosted
136136
version: "1.8.0"
137137
pedantic:
138138
dependency: transitive
139139
description:
140140
name: pedantic
141-
url: "https://pub.flutter-io.cn"
141+
url: "https://pub.dartlang.org"
142142
source: hosted
143143
version: "1.11.1"
144144
pub_semver:
145145
dependency: transitive
146146
description:
147147
name: pub_semver
148-
url: "https://pub.flutter-io.cn"
148+
url: "https://pub.dartlang.org"
149149
source: hosted
150150
version: "2.0.0"
151151
source_span:
152152
dependency: transitive
153153
description:
154154
name: source_span
155-
url: "https://pub.flutter-io.cn"
155+
url: "https://pub.dartlang.org"
156156
source: hosted
157157
version: "1.8.1"
158158
string_scanner:
159159
dependency: transitive
160160
description:
161161
name: string_scanner
162-
url: "https://pub.flutter-io.cn"
162+
url: "https://pub.dartlang.org"
163163
source: hosted
164164
version: "1.1.0"
165165
term_glyph:
166166
dependency: transitive
167167
description:
168168
name: term_glyph
169-
url: "https://pub.flutter-io.cn"
169+
url: "https://pub.dartlang.org"
170170
source: hosted
171171
version: "1.2.0"
172172
typed_data:
173173
dependency: transitive
174174
description:
175175
name: typed_data
176-
url: "https://pub.flutter-io.cn"
176+
url: "https://pub.dartlang.org"
177177
source: hosted
178178
version: "1.3.0"
179179
watcher:
180180
dependency: transitive
181181
description:
182182
name: watcher
183-
url: "https://pub.flutter-io.cn"
183+
url: "https://pub.dartlang.org"
184184
source: hosted
185185
version: "1.0.0"
186186
yaml:
187187
dependency: transitive
188188
description:
189189
name: yaml
190-
url: "https://pub.flutter-io.cn"
190+
url: "https://pub.dartlang.org"
191191
source: hosted
192192
version: "3.1.0"
193193
sdks:

pubspec.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
name: json2dart
1+
name: json2dartc
22
description: A CLI tool to help generate dart classes from json returned from API
3-
version: 1.1.0
3+
version: 1.0.0
44
homepage: https://www.github.com/pacifio/json2dart
55

66
environment:
77
sdk: '>=2.10.0 <3.0.0'
88

9+
executables:
10+
json2dartc:
11+
912
dependencies:
1013
json_ast: ^1.0.5
1114
args: ^2.2.0

0 commit comments

Comments
 (0)