Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------- 1 ----------
- //что будет напечатано в консоли?
- void main() async {
- methodA();
- await methodB();
- await methodC('main');
- methodD();
- }
- methodA(){
- print('A');
- }
- methodB() async {
- print('B start');
- await methodC('B');
- print('B end');
- }
- methodC(String from) async {
- print('C start from $from');
- Future((){ // <== This code will be executed some time in the future
- print('C running Future from $from');
- }).then((_){
- print('C end of Future from $from');
- });
- print('C end from $from');
- }
- methodD(){
- print('D');
- }
- //---------- 2 ----------
- //сколько экземпляров DateTime будет создано в процессе выполнения кода?
- extension Printed on DateTime {
- static DateTime printedNow() {
- print("DateTime created!");
- return DateTime.now();
- }
- }
- class CalendarHelper {
- static final today = Printed.printedNow();
- bool isToday(DateTime date) {
- return date.year == today.year && date.month == today.month && date.day == today.day;
- }
- }
- void main() {
- final list = List<CalendarHelper>.generate(50, (index) => CalendarHelper());
- print(list.last.isToday(Printed.printedNow()));
- }
- //---------- 3 ----------
- //что будет напечатано в консоли?
- int a;
- int b;
- a = 0;
- b = ++a;
- print(a == b);
- a = 0;
- b = a++;
- print(a == b);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement