diff --git a/bin/dart_application_1.dart b/bin/dart_application_1.dart index 2404519..77a6300 100644 --- a/bin/dart_application_1.dart +++ b/bin/dart_application_1.dart @@ -10,34 +10,46 @@ class View { Color? color; View(this.id, {this.color}); - @override String toString() { 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. + 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: + 2) Create new Text object with the following: var helloText = Text(, content: 'Hello' ) */ - int id = Random().nextInt(10000); + int textid= Random().nextInt(10000); +text hellotext =text(textid ,'hello'); + var helloText; + print('hello: ${helloText}'); +int id = Random().nextInt(10000); + print('hello:${hellotext}'); - print('hello: $helloText'); } void task2() { - List numbers = List.generate(75, (index) => Random().nextInt(10000)); - - /* - Separate even numbers from the above `numbers` list. - List evenNumbers = ... - */ - print('evenNumbers: $evenNumbers'); + import "dart:math"; +List numbers = List.generate(75, (index) => Random().nextInt(10000)); +int i=0; +List evenNumbers=[]; + +for(i in numbers);{ + if(i%2==0);{ + evenNumbers.add(i); + print(evenNumbers); + } + } +print('evenNumbers : ${evenNumbers}'); } +