From b630c48aa0e30273393a5ecbab5894c6cc9d1231 Mon Sep 17 00:00:00 2001 From: Baraa Basim Date: Sat, 25 Sep 2021 19:18:07 +0300 Subject: [PATCH 1/2] fix the code --- bin/dart_application_1.dart | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/bin/dart_application_1.dart b/bin/dart_application_1.dart index 2404519..54cc20f 100644 --- a/bin/dart_application_1.dart +++ b/bin/dart_application_1.dart @@ -16,8 +16,16 @@ class View { return '$id'; } } +class Text extends View{ + String content ; + Text(int id , this.content , {Color? color } ) : super (id, color : color ){ + + } +} void main() { + + /* 1) Create class named `Text` that extends/inherits `View` class, and has a `String content` property. @@ -28,16 +36,30 @@ void main() { */ int id = Random().nextInt(10000); + + var helloText = Text(id , "Hello"); + + print('hello: $helloText'); + task2(); } void task2() { - List numbers = List.generate(75, (index) => Random().nextInt(10000)); + List numbers = + List + .generate(75, (index) => Random() + .nextInt(10000)); /* Separate even numbers from the above `numbers` list. List evenNumbers = ... */ + + List evenNumbers = + numbers + .where((x) => x % 2 == 0 ) + .toList() ; + print('evenNumbers: $evenNumbers'); } From d0157bb8b1fde380703463cd17b851f38f43b565 Mon Sep 17 00:00:00 2001 From: Baraa Basim Date: Tue, 28 Sep 2021 12:35:02 +0300 Subject: [PATCH 2/2] add console result --- bin/dart_application_1.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/dart_application_1.dart b/bin/dart_application_1.dart index 54cc20f..cebcef1 100644 --- a/bin/dart_application_1.dart +++ b/bin/dart_application_1.dart @@ -63,3 +63,10 @@ void task2() { print('evenNumbers: $evenNumbers'); } + + +// result of console + +// hello: 4899 +// evenNumbers: [3822, 14, 6304, 1408, 6482, 9932, 8500, 3996, 6544, 5784, 6798, 3778, 5652, 214, 6546, 1820, 3312, 8790, 5060, 86, 3026, 9346, 3882, 3032, 306, 3840, 1304, 2296, 3672, 4418, 4104, 8886, 1112, 6438] +