Search
Results
How do you pass arguments from command line to main in Flutter/Dart? - Stack Overflow
[https://stackoverflow.com/questions/55004302/how-do-you-pass-arguments-from-command-line-to-main-in-flutter-dart] - - public:mzimmerm
The correct way: flutter run -d linux --dart-entrypoint-args 'arg1 arg2' file_with_main.dart => main(List args) => args[0]=arg1, args[1]=arg2 The workaround: flutter run -d linux --dart-define=PSEUDO_ARGS='arg1 arg2' file_with_main.dart => In main, use args=String.fromEnvironment('PSEUDO_ARGS').split(' ') => args[0]=arg1, args[1]=arg2