Search code examples
command-line-argumentsargvgetoptdart

How do I access argv / command line options in Dart?


And does Dart have a getopt library?


Solution

  • Using Options is no longer an option, use:

    void main(List<String> args) {
       print(args);
    }
    

    To get executable, use Platform.executable (Platform comes from dart:io)

    For parsing arguments passed to main, use this cool package