From 068f59bc5a4ad56ad96bbcba1f9fc96e90bd5db7 Mon Sep 17 00:00:00 2001 From: MohammadIq123 Date: Sat, 25 Sep 2021 21:04:19 +0300 Subject: [PATCH] Dart Task's solution --- bin/dart_application_1.dart | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/bin/dart_application_1.dart b/bin/dart_application_1.dart index 2404519..d015186 100644 --- a/bin/dart_application_1.dart +++ b/bin/dart_application_1.dart @@ -7,7 +7,7 @@ class Color { class View { int id; - Color? color; + Color color; View(this.id, {this.color}); @@ -17,6 +17,15 @@ class View { } } +class Text extends View +{ + + Text(int id, this.content, {Color color}) : super(id, color: color); + + String content; + +} + void main() { /* 1) Create class named `Text` that extends/inherits `View` class, @@ -26,18 +35,30 @@ void main() { 2) Create new `Text` object with the following: var helloText = Text(, content: 'Hello' ) */ + - int id = Random().nextInt(10000); + int id2 = Random().nextInt(10000); + var helloText = Text( id2, 'Hello' ); print('hello: $helloText'); + + task2(); } void task2() { - List numbers = List.generate(75, (index) => Random().nextInt(10000)); - + List numbers = List.generate(10, (index) => Random().nextInt(10000)); + print('evenNumbers: $numbers'); /* Separate even numbers from the above `numbers` list. List evenNumbers = ... */ - print('evenNumbers: $evenNumbers'); + List evenNumbers = []; + + for(var i=0; i