-
-
Save angelabauer/c19c42b7795a185d2113f3b47263d2c0 to your computer and use it in GitHub Desktop.
import 'dart:io'; | |
void main() { | |
performTasks(); | |
} | |
void performTasks() { | |
task1(); | |
task2(); | |
task3(); | |
} | |
void task1() { | |
String result = 'task 1 data'; | |
print('Task 1 complete'); | |
} | |
void task2() { | |
String result = 'task 2 data'; | |
print('Task 2 complete'); | |
} | |
void task3() { | |
String result = 'task 3 data'; | |
print('Task 3 complete'); | |
} |
For VS Code user, you can run this scratch file by running
dart scratch.dart
in Terminal.Result:
PS C:\Users\maple\Documents\Flutter course App Brewery\Learn-Flutter-AppBrewery\Section 13 Clima\Clima-Flutter> dart scratch.dart Task 1 complete Task 2 complete Task 3 complete PS C:\Users\maple\Documents\Flutter course App Brewery\Learn-Flutter-AppBrewery\Section 13 Clima\Clima-Flutter>
In VS Code, you can also get the Code Runner extension by Jun Han which will let you right-click on the scratch.dart file and click "Run Code" to achieve the same thing.
really a good teaching method
For VS Code user, you can run this scratch file by running
dart scratch.dart
in Terminal.
Result:PS C:\Users\maple\Documents\Flutter course App Brewery\Learn-Flutter-AppBrewery\Section 13 Clima\Clima-Flutter> dart scratch.dart Task 1 complete Task 2 complete Task 3 complete PS C:\Users\maple\Documents\Flutter course App Brewery\Learn-Flutter-AppBrewery\Section 13 Clima\Clima-Flutter>
In VS Code, you can also get the Code Runner extension by Jun Han which will let you right-click on the scratch.dart file and click "Run Code" to achieve the same thing.
same , i have use it for run ios/android/only single file .dart . flutter2.2_scratch_completed.dart
good good study
day day up!
good and nice try..
the course is outdated it is taking lot of time to debugging null safety
this course needs updates and re-shaping
not working because of null safety
just need to add : late on
Future task2() async {
Duration threeSeconds = Duration(seconds: 3);
late String result;
await Future.delayed(threeSeconds, () {
result = 'task 2 data';
print('Task 2 complete');
});
return result;
}
result =
Task 1 complete
Task 2 complete
Task 3 complete with task 2 data
Process finished with exit code 0
For VS Code user, you can run this scratch file by running
dart scratch.dart
in Terminal.Result: