From 7ab1fd17e2a841917f5c4a9faaf58f88cb8b72d3 Mon Sep 17 00:00:00 2001 From: Dena <81522341+Dena-sadiq@users.noreply.github.com> Date: Sun, 26 Sep 2021 07:35:29 +0300 Subject: [PATCH 1/2] Update dart_application_1.dart --- bin/dart_application_1.dart | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/dart_application_1.dart b/bin/dart_application_1.dart index 2404519..30e335e 100644 --- a/bin/dart_application_1.dart +++ b/bin/dart_application_1.dart @@ -26,7 +26,18 @@ void main() { 2) Create new `Text` object with the following: var helloText = Text(, content: 'Hello' ) */ - +class Text extends View { + String content; + Text(int id, this.content, {Color? color}) : super(id, color: color); +} + + + int textId = Random().nextInt(10000); + Text helloText = Text( + textId, + 'hello', + ); + int id = Random().nextInt(10000); print('hello: $helloText'); @@ -39,5 +50,7 @@ void task2() { Separate even numbers from the above `numbers` list. List evenNumbers = ... */ + List evenNumbers = numbers.where((e) => e % 2 == 0).toList(); + print('evenNumbers: $evenNumbers'); } From 67d76d865bfa2e718c8f8fff5507c4853fe4e915 Mon Sep 17 00:00:00 2001 From: Dena <81522341+Dena-sadiq@users.noreply.github.com> Date: Tue, 28 Sep 2021 15:09:05 +0300 Subject: [PATCH 2/2] update the dart-pass solution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thank you to inform me! and please tell me if you get the solution 🚩 --- bin/dart_application_1.dart | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/bin/dart_application_1.dart b/bin/dart_application_1.dart index 30e335e..9c48468 100644 --- a/bin/dart_application_1.dart +++ b/bin/dart_application_1.dart @@ -18,20 +18,14 @@ class View { } void main() { - /* - 1) Create class named `Text` that extends/inherits `View` class, - and has a `String content` property. - Here is the Text constuctor: - Text(int id, this.content, {Color? color}) : super(id, color: color) - 2) Create new `Text` object with the following: - var helloText = Text(, content: 'Hello' ) - */ + + // ----- class Text extends View class: ----- class Text extends View { String content; Text(int id, this.content, {Color? color}) : super(id, color: color); } - + // ----- Create new Text object: ----- int textId = Random().nextInt(10000); Text helloText = Text( textId, @@ -50,7 +44,14 @@ void task2() { Separate even numbers from the above `numbers` list. List evenNumbers = ... */ - List evenNumbers = numbers.where((e) => e % 2 == 0).toList(); - - print('evenNumbers: $evenNumbers'); + int i=0; +List evenNumbers=[]; + +for(i in numbers);{ + if(i%2==0);{ + evenNumbers.add(i); + print(evenNumbers); + } + } +print('evenNumbers : ${evenNumbers}'); }