This sample is a command line application that can be compiled to native code
using the dart2native command included in Dart 2.6. The
application fetches stats for a GitHub user and prints them to the console.
This sample also shows how to parse command line options into Dart objects using
package:build_cli_annotations and package:build.
To create a standalone executable, run the dart2native command on a Dart file
with a main() function. By default, it places the executable in the same
directory. The --output or -o flag is used to change the location of the
executable.
To build the executable:
dart2native bin/github_activity.dart -o github_activityTo run:
./github_activity --user jskeet
To build the executable:
dart2native bin\github_activity.dart -o github_activity.exeTo run:
github_activity.exe --user jskeet
The --output-kind or -k flag can be used to create an AOT snapshot:
dart2native bin/github_activity.dart -k aot -o github_activity.aotThis AOT snapshot can be run using the dartaotruntime command:
dartaotruntime github_activity.aot --user jskeetUse the --help flag for usage instructions:
./github_activity --help
If you run into rate limiting issues, you can generate a GitHub token and set it
to the GITHUB_TOKEN environment variable:
export GITHUB_TOKEN=<Your token>