sdk
sdk copied to clipboard
[dartdev] Allow using space between `-D` and variable
Note: Initially I thought this was an issue but it turns out it's working as expected -- so I updated it as a feature request.
-
Given
main.dart:void main(List<String> args) { print(String.fromEnvironment('name', defaultValue: 'null')); } -
Running the following:
# 1- does not work dart run --define name=osaxma bin/main.dart dart run --define "name=osaxma" bin/main.dart # 2- does work dart run --define=name=osaxma bin/main.dart dart run --define="name=osaxma" bin/main.dart # 3- does not work dart run -D name=osaxma bin/main.dart dart run -D "name=osaxma" bin/main.dart # 4- does work when no space between flag and variable dart run -Dname=osaxma bin/main.dart dart run -D"name=osaxma" bin/main.dart -
Result:
null null osaxma osaxma null null osaxma osaxma
It'd be nice if case 1 & 3 worked. Especially case 3 because -Dname looks unfamiliar and unexpected (at least for the CLIs that I'm used to).
Version: Dart SDK version: 2.18.1 (stable) (Tue Sep 13 11:42:55 2022 +0200) on "macos_x64"