Add documentation for using 'dart-define' with Dart apps
See original GitHub issueI had trouble using dart-define
after following https://dartcode.org/docs/using-dart-define-in-flutter/, not thinking about the fact that my app was a Dart app, not a Flutter app. I got it working in the end with a launch config like this:
{
"name": "Dart",
"request": "launch",
"type": "dart",
"program": "bin/dart_program.dart",
"toolArgs": ["-Dkey=blah"]
}
The differences that matter (as I understand) are -D
instead of dart-define
and using “toolArgs” rather than “args”. I think I understand why in both cases but I found that info with a fair bit of digging. I think it would be helpful to add some documentation for Dart apps like there is for Flutter.
Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to setup dart-define for keys and secrets on Android and ...
Head over to android/app/build.gradle and we'll be using the following code to parse every available variable from --dart-define and make them available as ......
Read more >Effective Dart: Documentation
Effective Dart: Documentation · DO use /// doc comments to document members and types. · PREFER writing doc comments for public APIs. ·...
Read more >Using --dart-define in Flutter - Dart Code
You can pass additional --dart-define values to Flutter by specifying them in the toolArgs field of your launch configuration ( launch.json ):.
Read more >How to use --dart-define in a Flutter app embdedded in Android
Was looking for a way to add "dart-define" to the gradle command so that the embedded Flutter app will have it available at...
Read more >How to Store API Keys in Flutter: --dart ... - Code With Andrea
Compiling and running the app with --dart-define. The main advantage of using --dart-define is that we're no longer hardcoding sensitive keys in ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks - I’ll add a Dart page about this, and link the two together. I think probably
toolArgs
is the right thing for both now, but I’ll verify that before updating. Thanks!Whoops, just checked and regular old
dart run --help
gives the “Define an environment declaration.” information… I could have sworn I looked in the help 🤦 well I learned about -v anyway so that’s awesome! 🙂