diff --git a/bin/dart_application_1.dart b/bin/dart_application_1.dart index 2404519..371b774 100644 --- a/bin/dart_application_1.dart +++ b/bin/dart_application_1.dart @@ -16,28 +16,43 @@ 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. - Here is the Text constuctor: + 1) Create class named Text that extends/inherits View class, + and has a String content property. + Here is the Text constructor: Text(int id, this.content, {Color? color}) : super(id, color: color) - 2) Create new `Text` object with the following: + 2) Create new Text object with the following: var helloText = Text(, content: 'Hello' ) */ int id = Random().nextInt(10000); - - print('hello: $helloText'); + var helloText = Text(id, "Fahad Hayan"); + print('hello: $helloText'); //The Output will be: hello: 4823 + task2(); //Here we call the function task2 } void task2() { List numbers = List.generate(75, (index) => Random().nextInt(10000)); - + List evenNumbers=[]; /* - Separate even numbers from the above `numbers` list. + Separate even numbers from the above numbers list. List evenNumbers = ... */ - print('evenNumbers: $evenNumbers'); + for (var i=0;i