Skip to content

Commit 06ed7c8

Browse files
authored
[dart] [dart-dio] Support Dart3 (#18001)
* Support both dart 2.x and 3.x * Append dart3 keywords * Update docs
1 parent f8d9151 commit 06ed7c8

File tree

20 files changed

+89
-131
lines changed

20 files changed

+89
-131
lines changed

bin/utils/dart-keywords/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ The last Dart version that was used to generate the keywords can be found in `da
1111

1212
## What does the shellscript do?
1313

14-
1. compile a dart app
15-
- `dart2native save-dart-keywords.dart`
16-
1714
1. run the dart app
18-
- `./save-dart-keywords.exe`
15+
- `dart run save-dart-keywords.dart`
1916

2017
1. the output is `dart-keywords.txt` and `dart-version.txt`
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Dart VM version: 2.7.0-dev.0.0 (Tue Nov 5 12:57:33 2019 +0100) on "macos_x64"
1+
Dart SDK version: 3.3.0 (stable) (Tue Feb 13 10:25:19 2024 +0000) on "macos_arm64"

bin/utils/dart-keywords/pubspec.lock

Lines changed: 57 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -5,190 +5,145 @@ packages:
55
dependency: transitive
66
description:
77
name: _fe_analyzer_shared
8-
url: "https://pub.dartlang.org"
8+
sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7"
9+
url: "https://pub.dev"
910
source: hosted
10-
version: "1.0.0"
11+
version: "67.0.0"
1112
analyzer:
1213
dependency: "direct main"
1314
description:
1415
name: analyzer
15-
url: "https://pub.dartlang.org"
16+
sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
17+
url: "https://pub.dev"
1618
source: hosted
17-
version: "0.39.1"
18-
args:
19-
dependency: transitive
20-
description:
21-
name: args
22-
url: "https://pub.dartlang.org"
23-
source: hosted
24-
version: "1.5.2"
19+
version: "6.4.1"
2520
async:
2621
dependency: transitive
2722
description:
2823
name: async
29-
url: "https://pub.dartlang.org"
30-
source: hosted
31-
version: "2.4.0"
32-
charcode:
33-
dependency: transitive
34-
description:
35-
name: charcode
36-
url: "https://pub.dartlang.org"
24+
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
25+
url: "https://pub.dev"
3726
source: hosted
38-
version: "1.1.2"
27+
version: "2.11.0"
3928
collection:
4029
dependency: transitive
4130
description:
4231
name: collection
43-
url: "https://pub.dartlang.org"
32+
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
33+
url: "https://pub.dev"
4434
source: hosted
45-
version: "1.14.12"
35+
version: "1.18.0"
4636
convert:
4737
dependency: transitive
4838
description:
4939
name: convert
50-
url: "https://pub.dartlang.org"
40+
sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592"
41+
url: "https://pub.dev"
5142
source: hosted
52-
version: "2.1.1"
43+
version: "3.1.1"
5344
crypto:
5445
dependency: transitive
5546
description:
5647
name: crypto
57-
url: "https://pub.dartlang.org"
58-
source: hosted
59-
version: "2.1.3"
60-
csslib:
61-
dependency: transitive
62-
description:
63-
name: csslib
64-
url: "https://pub.dartlang.org"
48+
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
49+
url: "https://pub.dev"
6550
source: hosted
66-
version: "0.16.1"
67-
front_end:
51+
version: "3.0.3"
52+
file:
6853
dependency: transitive
6954
description:
70-
name: front_end
71-
url: "https://pub.dartlang.org"
55+
name: file
56+
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
57+
url: "https://pub.dev"
7258
source: hosted
73-
version: "0.1.29"
59+
version: "7.0.0"
7460
glob:
7561
dependency: transitive
7662
description:
7763
name: glob
78-
url: "https://pub.dartlang.org"
79-
source: hosted
80-
version: "1.2.0"
81-
html:
82-
dependency: transitive
83-
description:
84-
name: html
85-
url: "https://pub.dartlang.org"
86-
source: hosted
87-
version: "0.14.0+3"
88-
js:
89-
dependency: transitive
90-
description:
91-
name: js
92-
url: "https://pub.dartlang.org"
64+
sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
65+
url: "https://pub.dev"
9366
source: hosted
94-
version: "0.6.1+1"
95-
kernel:
96-
dependency: transitive
97-
description:
98-
name: kernel
99-
url: "https://pub.dartlang.org"
100-
source: hosted
101-
version: "0.3.29"
67+
version: "2.1.2"
10268
meta:
10369
dependency: transitive
10470
description:
10571
name: meta
106-
url: "https://pub.dartlang.org"
107-
source: hosted
108-
version: "1.1.8"
109-
node_interop:
110-
dependency: transitive
111-
description:
112-
name: node_interop
113-
url: "https://pub.dartlang.org"
114-
source: hosted
115-
version: "1.0.3"
116-
node_io:
117-
dependency: transitive
118-
description:
119-
name: node_io
120-
url: "https://pub.dartlang.org"
72+
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
73+
url: "https://pub.dev"
12174
source: hosted
122-
version: "1.0.1+2"
75+
version: "1.12.0"
12376
package_config:
12477
dependency: transitive
12578
description:
12679
name: package_config
127-
url: "https://pub.dartlang.org"
80+
sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd"
81+
url: "https://pub.dev"
12882
source: hosted
129-
version: "1.1.0"
83+
version: "2.1.0"
13084
path:
13185
dependency: transitive
13286
description:
13387
name: path
134-
url: "https://pub.dartlang.org"
135-
source: hosted
136-
version: "1.6.4"
137-
pedantic:
138-
dependency: transitive
139-
description:
140-
name: pedantic
141-
url: "https://pub.dartlang.org"
88+
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
89+
url: "https://pub.dev"
14290
source: hosted
143-
version: "1.8.0+1"
91+
version: "1.9.0"
14492
pub_semver:
14593
dependency: transitive
14694
description:
14795
name: pub_semver
148-
url: "https://pub.dartlang.org"
96+
sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c"
97+
url: "https://pub.dev"
14998
source: hosted
150-
version: "1.4.2"
99+
version: "2.1.4"
151100
source_span:
152101
dependency: transitive
153102
description:
154103
name: source_span
155-
url: "https://pub.dartlang.org"
104+
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
105+
url: "https://pub.dev"
156106
source: hosted
157-
version: "1.5.5"
107+
version: "1.10.0"
158108
string_scanner:
159109
dependency: transitive
160110
description:
161111
name: string_scanner
162-
url: "https://pub.dartlang.org"
112+
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
113+
url: "https://pub.dev"
163114
source: hosted
164-
version: "1.0.5"
115+
version: "1.2.0"
165116
term_glyph:
166117
dependency: transitive
167118
description:
168119
name: term_glyph
169-
url: "https://pub.dartlang.org"
120+
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
121+
url: "https://pub.dev"
170122
source: hosted
171-
version: "1.1.0"
123+
version: "1.2.1"
172124
typed_data:
173125
dependency: transitive
174126
description:
175127
name: typed_data
176-
url: "https://pub.dartlang.org"
128+
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
129+
url: "https://pub.dev"
177130
source: hosted
178-
version: "1.1.6"
131+
version: "1.3.2"
179132
watcher:
180133
dependency: transitive
181134
description:
182135
name: watcher
183-
url: "https://pub.dartlang.org"
136+
sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8"
137+
url: "https://pub.dev"
184138
source: hosted
185-
version: "0.9.7+12"
139+
version: "1.1.0"
186140
yaml:
187141
dependency: transitive
188142
description:
189143
name: yaml
190-
url: "https://pub.dartlang.org"
144+
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
145+
url: "https://pub.dev"
191146
source: hosted
192-
version: "2.2.0"
147+
version: "3.1.2"
193148
sdks:
194-
dart: ">=2.6.0 <3.0.0"
149+
dart: ">=3.0.0 <4.0.0"

bin/utils/dart-keywords/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Use the Dart SDK to generate Dart keywords.
44
version: 1.0.0+1
55

66
environment:
7-
sdk: ">=2.6.0 <3.0.0"
7+
sdk: ">=3.0.0 <4.0.0"
88

99
dependencies:
1010
analyzer:

bin/utils/dart-keywords/save-dart-keywords.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@ import 'package:analyzer/dart/ast/token.dart';
44

55
main() {
66
// save keywords to a text file
7-
final txtFile = File(
7+
final output = File(
88
'../../../modules/openapi-generator/src/main/resources/dart/dart-keywords.txt');
9-
String txtString = '';
10-
for (String keyword in Keyword.keywords.keys.toList()) {
11-
txtString += keyword + '\n';
12-
}
13-
txtString =
14-
txtString.substring(0, txtString.length - 1); // remove last newline
15-
txtFile.writeAsStringSync(txtString);
9+
final keywords = Keyword.keywords.keys.join('\n');
10+
output.writeAsStringSync(keywords);
1611
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
dart2native save-dart-keywords.dart
2-
./save-dart-keywords.exe
3-
dart --version &> dart-version.txt
1+
dart run save-dart-keywords.dart
2+
dart --version &> dart-version.txt

docs/generators/dart-dio.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
7070
<li>as</li>
7171
<li>assert</li>
7272
<li>async</li>
73+
<li>augment</li>
7374
<li>await</li>
75+
<li>base</li>
7476
<li>break</li>
7577
<li>case</li>
7678
<li>catch</li>
@@ -118,6 +120,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
118120
<li>required</li>
119121
<li>rethrow</li>
120122
<li>return</li>
123+
<li>sealed</li>
121124
<li>set</li>
122125
<li>show</li>
123126
<li>source</li>
@@ -132,6 +135,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
132135
<li>typedef</li>
133136
<li>var</li>
134137
<li>void</li>
138+
<li>when</li>
135139
<li>while</li>
136140
<li>with</li>
137141
<li>yield</li>

docs/generators/dart.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ title: Documentation for the dart Generator
1111
| generator type | CLIENT | |
1212
| generator language | Dart | |
1313
| generator default templating engine | mustache | |
14-
| helpTxt | Generates a Dart 2.x client library. | |
14+
| helpTxt | Generates a Dart client library. | |
1515

1616
## CONFIG OPTIONS
1717
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
@@ -68,7 +68,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
6868
<li>as</li>
6969
<li>assert</li>
7070
<li>async</li>
71+
<li>augment</li>
7172
<li>await</li>
73+
<li>base</li>
7274
<li>break</li>
7375
<li>case</li>
7476
<li>catch</li>
@@ -116,6 +118,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
116118
<li>required</li>
117119
<li>rethrow</li>
118120
<li>return</li>
121+
<li>sealed</li>
119122
<li>set</li>
120123
<li>show</li>
121124
<li>source</li>
@@ -130,6 +133,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
130133
<li>typedef</li>
131134
<li>var</li>
132135
<li>void</li>
136+
<li>when</li>
133137
<li>while</li>
134138
<li>with</li>
135139
<li>yield</li>

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public String getName() {
212212

213213
@Override
214214
public String getHelp() {
215-
return "Generates a Dart 2.x client library.";
215+
return "Generates a Dart client library.";
216216
}
217217

218218
@Override

modules/openapi-generator/src/main/resources/dart/dart-keywords.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ abstract
22
as
33
assert
44
async
5+
augment
56
await
7+
base
68
break
79
case
810
catch
@@ -50,6 +52,7 @@ patch
5052
required
5153
rethrow
5254
return
55+
sealed
5356
set
5457
show
5558
source
@@ -64,6 +67,7 @@ try
6467
typedef
6568
var
6669
void
70+
when
6771
while
6872
with
6973
yield

0 commit comments

Comments
 (0)