-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathflutter.ts
1664 lines (1606 loc) · 55.5 KB
/
flutter.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Flutter version 2.0.1
import { filepaths } from "@fig/autocomplete-generators";
const flutterGenerators: Record<string, Fig.Generator> = {
emulators: {
script: ["flutter", "emulators"],
postProcess: function (out) {
return out
.match(/.*•.*/gi)
.map((info) => info.split("•"))
.map((deviceInfo) => deviceInfo.map((info) => info.trim()))
.map((device) => ({
name: `${device[1]} • ${device[2]} • ${device[3]}`,
icon: "📱",
description: "Available emulators",
insertValue: device[0],
}));
},
},
dartFiles: filepaths({ extensions: ["dart"] }),
};
const help = {
name: ["-h", "--help"],
description: "Print this usage information",
};
const verbose = {
name: ["-v", "--verbose"],
description:
"Noisy logging, including all shell commands executed. If used with --help, shows hidden options",
};
const deviceId = {
name: ["-d", "--device-id"],
insertValue: "--device-id '{cursor}'",
description: "Target device id or name (prefixes allowed)",
args: {
name: "device id",
description: "Target device id or name (prefixes allowed)",
generators: flutterGenerators.emulators,
},
};
const version = {
name: "--version",
description: "Reports the version of this tool",
};
const suppressAnalytics = {
name: "--suppress-analytics",
description: "Suppress analytics reporting when this command runs",
};
const globalOpts = [help, verbose, deviceId, suppressAnalytics];
// yes no options
const pub = [
{
name: "--pub",
description: "Run 'flutter pub get' before executing this command",
},
{
name: "--no-pub",
description: "Don't run 'flutter pub get' before executing this command",
},
];
const currentPackage = [
{
name: "--current-package",
description: "Analyze the current project, if applicable",
},
{
name: "--no-current-package",
description: "Don't analyze the current project, if applicable",
},
];
const congratulate = [
{
name: "--congratulate",
description:
"Show output even when there are no errors, warnings, hints, or lints. Ignored if --watch is specified",
},
{
name: "--no-congratulate",
description:
"Hide output even when there are no errors, warnings, hints, or lints. Ignored if --watch is specified",
},
];
const preamble = [
{
name: "--preamble",
description:
"When analyzing the flutter repository, display the number of files that will be analyzed. Ignored if --watch is specified",
},
{
name: "--no-preamble",
description:
"When analyzing the flutter repository, don't display the number of files that will be analyzed. Ignored if --watch is specified",
},
];
const fatalInfos = [
{
name: "--fatal-infos",
description: "Treat info level issues as fatal",
},
{
name: "--no-fatal-infos",
description: "Don't treat info level issues as fatal",
},
];
const fatalWarnings = [
{
name: "--fatal-warnings",
description: "Treat warning level issues as fatal",
},
{
name: "--no-fatal-warnings",
description: "Don't treat warning level issues as fatal",
},
];
const nullAssertions = [
{
name: "--null-assertions",
description:
"Perform additional null assertions on the boundaries of migrated and un-migrated code. This setting is not currently supported on desktop devices",
},
{
name: "--no-null-assertions",
description:
"Not performing additional null assertions on the boundaries of migrated and un-migrated code. This setting is not currently supported on desktop devices",
},
];
const trackWidgetCreation = [
{
name: "--track-widget-creation",
description:
"Track widget creation locations. This enables features such as the widget inspector. This parameter is only functional in debug mode (i.e. when compiling JIT, not AOT)",
},
{
name: "--no-track-widget-creation",
description:
"No tracking widget creation locations. This disables features such as the widget inspector. This parameter is only functional in debug mode (i.e. when compiling JIT, not AOT)",
},
];
const testAssets = [
{
name: "--test-assets",
description:
"Build the assets bundle for testing. Consider using --no-test-assets if assets are not required",
},
{
name: "--no-test-assets",
description: "Exclude the assets bundle for build testing",
},
];
const uninstallOnly = [
{
name: "--uninstall-only",
description: "Uninstall the app if already on the device. Skip install",
},
{
name: "--no-uninstall-only",
},
];
const useDeferredLoading = [
{
name: "--use-deferred-loading",
description:
"Generate the Dart localization file with locales imported as deferred, allowing for lazy loading of each locale in Flutter web. \n\nThis can reduce a web app’s initial startup time by decreasing the size of the JavaScript bundle. When this flag is set to true, the messages for a particular locale are only downloaded and loaded by the Flutter app as they are needed. For projects with a lot of different locales and many localization strings, it can be an performance improvement to have deferred loading. For projects with a small number of locales, the difference is negligible, and might slow down the start up compared to bundling the localizations with the rest of the application. \n\nNote that this flag does not affect other platforms such as mobile or desktop",
},
{
name: "--no-use-deferred-loading",
description:
"Don't generate the Dart localization file with locales imported as deferred",
},
];
const syntheticPackage = [
{
name: "--synthetic-package",
description:
"Determines that the generated output files will be generated as a synthetic package or at a specified directory in the Flutter project. \n\nThis flag is set to true by default. \n\nWhen synthetic-package is set to false, it will generate the localizations files in the directory specified by arb-dir by default. \n\nIf output-dir is specified, files will be generated there",
},
{
name: "--no-synthetic-package",
},
];
const requiredResourceAttributes = [
{
name: "--required-resource-attributes",
description:
"Requires all resource ids to contain a corresponding resource attribute. \n\nBy default, simple messages will not require metadata, but it is highly recommended as this provides context for the meaning of a message to readers. \n\nResource attributes are still required for plural messages",
},
{
name: "--no-required-resource-attributes",
},
];
const startPaused = [
{
name: "--start-paused",
description: "Start in a paused mode and wait for a debugger to connect",
},
{
name: "--no-start-paused",
},
];
const keepAppRunning = [
{
name: "--keep-app-running",
description:
'Will keep the Flutter application running when done testing. By default, "flutter drive" stops the application after tests are finished, and --keep-app-running overrides this. On the other hand, if --use-existing-app is specified, then "flutter drive" instead defaults to leaving the application running, and --no-keep-app-running overrides it',
},
{
name: "--no-keep-app-running",
},
];
const build = [
{
name: "--build",
description:
"(Deprecated) Build the app before running. To use an existing app, pass the --use-application-binary flag with an existing APK (defaults to on)",
},
{
name: "--no-build",
},
];
const headless = [
{
name: "--headless",
description:
"Whether the driver browser is going to be launched in headless mode. Defaults to true",
},
{
name: "--no-headless",
},
];
const androidEmulator = [
{
name: "--android-emulator",
description:
"Whether to perform Flutter Driver testing on Android Emulator.Works only if 'browser-name' is set to 'android-chrome'",
},
{
name: "--no-android-emulator",
},
];
const awaitFirstFrameWhenTracing = [
{
name: "--await-first-frame-when-tracing",
description:
'Whether to wait for the first frame when tracing startup ("--trace-startup"), or just dump the trace as soon as the application is running. The first frame is detected by looking for a Timeline event with the name "Rasterized first useful frame". By default, the widgets library\'s binding takes care of sending this event',
},
{
name: "--no-await-first-frame-when-tracing",
},
];
const useTestFonts = [
{
name: "--use-test-fonts",
description:
'Enable (and default to) the "Ahem" font. This is a special font used in tests to remove any dependencies on the font metrics. It is enabled when you use "flutter test". Set this flag when running a test using "flutter run" for debugging purposes. This flag is only available when running in debug mode',
},
{
name: "--no-use-test-fonts",
},
];
const hot = [
{
name: "--hot",
description:
'Run with support for hot reloading. Only available for debug mode. Not available with "--trace-startup"',
},
{
name: "--no-hot",
},
];
const fastStart = [
{
name: "--fast-start",
description:
"Whether to quickly bootstrap applications with a minimal app. Currently this is only supported on Android devices. This option cannot be paired with --use-application-binary",
},
{
name: "--no-fast-start",
},
];
const offline = [
{
name: "--offline",
description:
'When "flutter pub get" is run by the create command, this indicates whether to run it in offline mode or not. In offline mode, it will need to have all dependencies already available in the pub cache to succeed',
},
{
name: "--no-offline",
},
];
const withDriverTest = [
{
name: "--with-driver-test",
description:
"(Deprecated) Also add a flutter_driver dependency and generate a sample 'flutter drive' test. This flag has been deprecated, instead see package:integration_test at https://pub.dev/packages/integration_test",
},
{
name: "--no-with-driver-test",
},
];
const overwrite = [
{
name: "--overwrite",
description: "When performing operations, overwrite existing files",
},
{
name: "--no-overwrite",
},
];
const analytics = [
{
name: "--analytics",
description:
"Enable reporting anonymously tool usage statistics and crash reports",
},
{
name: "--no-analytics",
description:
"Disable reporting anonymously tool usage statistics and crash reports",
},
];
const enableWeb = [
{
name: "--enable-web",
description:
"Enable Flutter for web. This setting will take effect on the master, dev, beta, and stable channels",
},
{
name: "--no-enable-web",
description:
"Disable Flutter for web. This setting will take effect on the master, dev, beta, and stable channels",
},
];
const enableLinuxDesktop = [
{
name: "--enable-linux-desktop",
description:
"Enable beta-quality support for desktop on Linux. This setting will take effect on the master, dev, beta, and stable channels. Newer beta versions are available on the beta channel",
},
{
name: "--no-enable-linux-desktop",
description:
"Disable beta-quality support for desktop on Linux. This setting will take effect on the master, dev, beta, and stable channels. Newer beta versions are available on the beta channel",
},
];
const enableMacosDesktop = [
{
name: "--enable-macos-desktop",
description:
"Enable beta-quality support for desktop on macOS. This setting will take effect on the master, dev, beta, and stable channels. Newer beta versions are available on the beta channel",
},
{
name: "--no-enable-macos-desktop",
description:
"Disable beta-quality support for desktop on macOS. This setting will take effect on the master, dev, beta, and stable channels. Newer beta versions are available on the beta channel",
},
];
const enableWidowsDesktop = [
{
name: "--enable-windows-desktop",
description:
"Enable beta-quality support for desktop on Windows. This setting will take effect on the master, dev, beta, and stable channels. Newer beta versions are available on the beta channel",
},
{
name: "--no-enable-windows-desktop",
description:
"Disable beta-quality support for desktop on Windows. This setting will take effect on the master, dev, beta, and stable channels. Newer beta versions are available on the beta channel",
},
];
const singleWidgetReloadOptimization = [
{
name: "--single-widget-reload-optimization",
description:
"Enable Hot reload optimization for changes to class body of a single widget. This setting will take effect on the master, dev, and beta channels",
},
{
name: "--no-single-widget-reload-optimization",
description:
"Disable Hot reload optimization for changes to class body of a single widget. This setting will take effect on the master, dev, and beta channels",
},
];
const enableAndroid = [
{
name: "--enable-android",
description:
"Enable Flutter for Android. This setting will take effect on the master, dev, beta, and stable channels",
},
{
name: "--no-enable-android",
description:
"Disable Flutter for Android. This setting will take effect on the master, dev, beta, and stable channels",
},
];
const enableIos = [
{
name: "--enable-ios",
description:
"Enable Flutter for iOS. This setting will take effect on the master, dev, beta, and stable channels",
},
{
name: "--no-enable-ios",
description:
"Disable Flutter for iOS. This setting will take effect on the master, dev, beta, and stable channels",
},
];
const enabledFuchsia = [
{
name: "--enable-fuchsia",
description:
"Enable Flutter for Fuchsia. This setting will take effect on the master channel",
},
{
name: "--no-enable-fuchsia",
description:
"Disable Flutter for Fuchsia. This setting will take effect on the master channel",
},
];
const experimentalInvalidationStrategy = [
{
name: "--experimental-invalidation-strategy",
description:
"Enable Hot reload optimization that reduces incremental artifact size. This setting will take effect on the master, dev, and beta channels",
},
{
name: "--no-experimental-invalidation-strategy",
description:
"Disable Hot reload optimization that reduces incremental artifact size. This setting will take effect on the master, dev, and beta channels",
},
];
// opts
const deviceUser = {
name: "--device-user",
description:
'Identifier number for a user or work profile on Android only. Run "adb shell pm list users" for available identifiers',
args: {
name: "seconds",
},
};
const deviceTimeout = {
name: "--device-timeout",
description:
"Time in seconds to wait for devices to attach. Longer timeouts may be necessary for networked devices",
args: {
name: "seconds",
},
};
const debug = {
name: "--debug",
description: "Build a debug version of your app (default mode)",
};
const profile = {
name: "--profile",
description:
"Build a version of your app specialized for performance profiling",
};
const target = {
name: ["-t", "--target"],
insertValue: "--target ",
description:
'The main entry-point file of the application, as run on the device. If the --target option is omitted, but a file name is provided on the command line, then that is used instead. (defaults to "lib/main.dart")',
args: {
name: ".dart file path",
template: "filepaths",
},
};
const observatoryPort = {
name: "--observatory-port",
description:
"(deprecated use host-vmservice-port instead) Listen to the given port for an observatory debugger connection. Specifying port 0 (the default) will find a random free port",
};
const deviceVmservicePort = {
name: "--device-vmservice-port",
description:
"Look for vmservice connections only from the specified port. Specifying port 0 (the default) will accept the first vmservice discovered",
};
const hostVmServicePort = {
name: "--host-vmservice-port",
description:
"When a device-side vmservice port is forwarded to a host-side port, use this value as the host port. Specifying port 0 (the default) will find a random free host port",
};
const dartDefine = {
name: "--dart-define",
description:
"Additional key-value pairs that will be available as constants from the String.fromEnvironment, bool.fromEnvironment, int.fromEnvironment, and double.fromEnvironment constructors",
args: {
name: "foo=bar",
},
};
// run and drive
const run = [
debug,
profile,
{
name: "--release",
description: "Build a release version of your app",
},
dartDefine,
{
name: "--flavor",
description:
"Build a custom app flavor as defined by platform-specific build setup. Supports the use of product flavors in Android Gradle scripts, and the use of custom Xcode schemes",
},
{
name: "--web-renderer",
description:
"The renderer implementation to use when building for the web. Possible values are: html - always use the HTML renderer. This renderer uses a combination of HTML, CSS, SVG, 2D Canvas, and WebGL. This is the default. canvaskit - always use the CanvasKit renderer. This renderer uses WebGL and WebAssembly to render graphics. auto - use the HTML renderer on mobile devices, and CanvasKit on desktop devices. [auto (default), canvaskit, html]",
},
{
name: "--trace-startup",
description:
"Trace application startup, then exit, saving the trace to a file",
},
{
name: "--verbose-system-logs",
description: "Include verbose logging from the flutter engine",
},
{
name: "--cache-sksl",
description: "Only cache the shader in SkSL instead of binary or GLSL",
},
{
name: "--dump-skp-on-shader-compilation",
description:
"Automatically dump the skp that triggers new shader compilations. This is useful for writing custom ShaderWarmUp to reduce jank. By default, this is not enabled to reduce the overhead. This is only available in profile or debug build",
},
{
name: "--purge-persistent-cache",
description:
"Removes all existing persistent caches. This allows reproducing shader compilation jank that normally only happens the first time an app is run, or for reliable testing of compilation jank fixes (e.g. shader warm-up)",
},
{
name: "--route",
description: "Which route to load when running the app",
},
{
name: "--vmservice-out-file",
description:
"A file to write the attached vmservice uri to after an application is started. e.g. project/example/out.txt",
args: {
name: ".txt output file path",
template: "filepaths",
},
},
{
name: "--use-application-binary",
description:
"Specify a pre-built application binary to use when running. For android applications, this must be the path to an APK. For iOS applications, the path to an IPA. Other device types do not yet support prebuilt application binaries. e.g. path/to/app.apk",
args: {
name: "file path to .apk",
template: "filepaths",
},
},
{
name: "--endless-trace-buffer",
description:
'Enable tracing to the endless tracer. This is useful when recording huge amounts of traces. If we need to use endless buffer to record startup traces, we can combine the ("--trace-startup"). For example, flutter run --trace-startup --endless-trace-buffer',
},
{
name: "--trace-systrace",
description:
"Enable tracing to the system tracer. This is only useful on platforms where such a tracer is available (Android and Fuchsia)",
},
{
name: "--trace-skia",
description:
"Enable tracing of Skia code. This is useful when debugging the raster thread (formerly known as the GPU thread). By default, Flutter will not log skia code",
},
{
name: ["-a", "--dart-entrypoint-args"],
insertValue: "--dart-entrypoint-args",
description:
"Pass a list of arguments to the Dart entrypoint at application startup. By default this is main(List<String> args). Specify this option multiple times each with one argument to pass multiple arguments to the Dart entrypoint. Currently this is only supported on desktop platforms",
isRepeatable: true,
},
target,
observatoryPort,
deviceVmservicePort,
hostVmServicePort,
...pub,
...trackWidgetCreation,
...nullAssertions,
deviceUser,
deviceTimeout,
{
name: "--dds-port",
description:
"When this value is provided, the Dart Development Service (DDS) will be bound to the provided port. Specifying port 0 (the default) will find a random free port",
},
{
name: "--devtools-server-address",
description:
"When this value is provided, the Flutter tool will not spin up a new DevTools server instance, but instead will use the one provided at this address",
},
];
// spec
const completionSpec = {
name: "flutter",
description: "Run flutter command",
subcommands: [
{
name: "analyze",
description: "Analyze the project's Dart code",
options: [
...globalOpts,
...currentPackage,
{
name: "--watch",
description:
"Run analysis continuously, watching the filesystem for changes",
},
{
name: "--write",
description:
"Also output the results to a file. This is useful with --watch if you want a file to always contain the latest results",
args: {
name: "file path",
template: "filepaths",
},
},
...pub,
...congratulate,
...preamble,
...fatalInfos,
...fatalWarnings,
],
},
{
name: "assemble",
description: "Assemble and build Flutter resources",
options: [
...globalOpts,
{
name: ["-d", "--define"],
description:
"Allows passing configuration to a target with --define=target=key=value",
insertValue: "--define",
},
{
name: "--performance-measurement-file",
description: "Output individual target performance to a JSON file",
},
{
name: ["-i", "--input"],
description: "Treat warning level issues as fatal",
insertValue: "--input",
},
{
name: "--depfile",
description:
"A file path where a depfile will be written. This contains all build inputs and outputs in a make style syntax",
},
{
name: "--build-inputs",
description:
"A file path where a newline separated file containing all inputs used will be written after a build. This file is not included as a build input or output. This file is not written if the build fails for any reason",
},
{
name: "--build-outputs",
description:
"A file path where a newline separated file containing all outputs used will be written after a build. This file is not included as a build input or output. This file is not written if the build fails for any reason",
},
{
name: ["-o", "--output"],
description:
"A directory where output files will be written. Must be either absolute or relative from the root of the current Flutter project",
insertValue: "--output",
},
{
name: "--ExtraGenSnapshotOptions",
},
{
name: "--ExtraFrontEndOptions",
},
{
name: "--DartDefines",
},
{
name: "--resource-pool-size",
description:
"The maximum number of concurrent tasks the build system will run",
},
],
},
{
name: "attach",
description: "Attach to a running app",
options: [
...globalOpts,
debug,
profile,
target,
observatoryPort,
deviceVmservicePort,
hostVmServicePort,
dartDefine,
deviceUser,
...nullAssertions,
{
name: "--debug-uri",
description: "The URI at which the observatory is listening",
},
{
name: "--app-id",
description:
'The package name (Android) or bundle identifier (iOS) for the app. This can be specified to avoid being prompted if multiple observatory ports are advertised. If you have multiple devices or emulators running, you should include the device hostname as well, e.g. "com.example.myApp@my-iphone". This parameter is case-insensitive',
},
{
name: "--pid-file",
description:
"Specify a file to write the process id to. You can send SIGUSR1 to trigger a hot reload and SIGUSR2 to trigger a hot restart",
},
...trackWidgetCreation,
{
name: "--dds-port",
description:
"When this value is provided, the Dart Development Service (DDS) will be bound to the provided port. Specifying port 0 (the default) will find a random free port",
},
{
name: "--devtools-server-address",
description:
"When this value is provided, the Flutter tool will not spin up a new DevTools server instance, but instead will use the one provided at this address",
},
deviceTimeout,
],
},
{
name: "bash-completion",
description: "Output command line shell completion setup scripts",
options: [...globalOpts, ...overwrite],
},
{
name: "build",
description: "Build an executable app or install bundle",
options: [
...globalOpts,
{
name: ["-t", "--target"],
insertValue: "--target ",
description:
'The main entry-point file of the application, as run on the device.\n If the --target option is omitted, but a file name is provided on the command line, then that is used instead.\n(defaults to "lib/main.dart")',
args: {
name: "path",
generators: flutterGenerators.dartFiles,
},
},
],
args: {
name: "executable-type",
description: "",
suggestions: [
{
name: "aar",
description: "Build a repository containing an AAR and a POM file",
type: "argument",
icon: "📦",
},
{
name: "apk",
description: "Build an Android APK file from your app",
type: "argument",
icon: "🤖",
},
{
name: "appbundle",
description: "Build an Android App Bundle file from your app",
type: "argument",
icon: "🤖",
},
{
name: "bundle",
description: "Build the Flutter assets directory from your app",
type: "argument",
icon: "📦",
},
{
name: "ios",
description: "Build an iOS application bundle (Mac OS X host only)",
type: "argument",
icon: "📱",
},
{
name: "ios-framework",
description:
"Produces .xcframeworks for a Flutter project and its plugins for integration into existing, plain Xcode projects",
type: "argument",
icon: "📱",
},
{
name: "ipa",
description: "Build an iOS archive bundle (Mac OS X host only)",
type: "argument",
icon: "📱",
},
{
name: "web",
description: "Build a web application bundle",
type: "argument",
icon: "🌎",
},
],
},
},
{
name: "channel",
description: "List or switch Flutter channels",
args: {
name: "channel-name",
description:
"Switch to <channel name>. Leave this blank to see available channels",
generators: {
script: ["flutter", "channel"],
postProcess: function (out) {
return out
.split("\n")
.filter((channel) => channel.match(/\w+$/))
.map((channel) => ({
name: channel.trim().match(/\w+/)[0],
active: channel.match(/\*/) != null,
}))
.map((channel) => ({
name: `${channel.name}${channel.active ? " ✅" : ""}`,
icon: "🐦",
description: "Available channels",
insertValue: channel.name,
}));
},
},
},
},
{
name: "clean",
description: "Delete the build/ and .dart_tool/ directories",
options: globalOpts,
},
{
name: "config",
description: "Configure Flutter settings",
options: [
...globalOpts,
...analytics,
{
name: "--clear-ios-signing-cert",
description:
"Clear the saved development certificate choice used to sign apps for iOS device deployment",
},
{
name: "--android-sdk",
description: "The Android SDK directory",
},
{
name: "--android-studio-dir",
description: "The Android Studio install directory",
},
{
name: "--build-dir",
description:
"The relative path to override a projects build directory",
args: {
name: "path",
template: "folders",
},
},
...enableWeb,
...enableLinuxDesktop,
...enableMacosDesktop,
...enableWidowsDesktop,
...singleWidgetReloadOptimization,
...enableAndroid,
...enableIos,
...enabledFuchsia,
...experimentalInvalidationStrategy,
{
name: "--clear-features",
description:
"Remove all configured features and restore them to the default values",
},
],
},
{
name: "create",
description: "Create a new Flutter project",
options: [
...globalOpts,
...pub,
...offline,
...withDriverTest,
...overwrite,
{
name: "--description",
description:
'The description to use for your new Flutter project. This string ends up in the pubspec.yaml file. (defaults to "A new Flutter project.")',
},
{
name: "--org",
description:
'The organization responsible for your new Flutter project, in reverse domain name notation. This string is used in Java package names and as prefix in the iOS bundle identifier. (defaults to "com.example")',
},
{
name: "--project-name",
description:
"The project name for this new Flutter project. This must be a valid dart package name",
},
{
name: ["-i", "--ios-language"],
insertValue: "--ios-language ",
description: "[objc, swift (default)]",
args: {
suggestions: [
{
name: "objc",
type: "argument",
icon: "📱",
},
{
name: "swift (default)",
insertValue: "swift",
type: "argument",
icon: "📱",
},
],
},
},
{
name: ["-a", "--android-language"],
insertValue: "--android-language ",
description: "[java, kotlin (default)]",
args: {
suggestions: [
{
name: "java",
type: "argument",
icon: "🤖",
},
{
name: "kotlin (default)",
insertValue: "kotlin",
type: "argument",
icon: "🤖",
},
],
},
},
{
name: "--platforms",
description: