diff --git a/bin/dart_application_1.dart b/bin/dart_application_1.dart index 2404519..9c48468 100644 --- a/bin/dart_application_1.dart +++ b/bin/dart_application_1.dart @@ -18,15 +18,20 @@ 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, + 'hello', + ); + int id = Random().nextInt(10000); print('hello: $helloText'); @@ -39,5 +44,14 @@ void task2() { Separate even numbers from the above `numbers` list. List evenNumbers = ... */ - print('evenNumbers: $evenNumbers'); + int i=0; +List evenNumbers=[]; + +for(i in numbers);{ + if(i%2==0);{ + evenNumbers.add(i); + print(evenNumbers); + } + } +print('evenNumbers : ${evenNumbers}'); }