June 2017
Intermediate to advanced
873 pages
18h 9m
English
A server app that runs a batch job often takes parameter values from the command line. How can we get these values in our program?
The obvious way to parse command-line arguments is as follows (see command_line_arguments.dart):
void main(List<String> args) { print("script arguments:"); for(String arg in args) print(arg); }
Now, the command dart command_line_arguments.dart param1 param2 param3 gives you the following output:
script arguments:
param1
param2
param3
However, you can also test this from within Dart Editor, open the menu Run, and select Manage Launches (Ctrl + Shift + M). Fill in the parameters in the Script arguments window:
Script arguments
What if your parameters are in the key:value ...
Read now
Unlock full access