Yet Another Bookmarks Service



[https://www.darttutorial.org/dart-tutorial/dart-future/] - - public:mzimmerm
async, dart, future, good - 4 | id:1485371 -

a) add the async keyword to the main() function. b) add the await keyword in front of the future object. Result: Once Dart encounters the await keyword, it sends all the code starting from that line to the event queue and waits for the future to complete. That’s why you see the number 2 before 3.

[https://stackoverflow.com/questions/55004302/how-do-you-pass-arguments-from-command-line-to-main-in-flutter-dart] - - public:mzimmerm
command, dart, main, parameter - 4 | id:1420580 -

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

Follow Tags