diff --git a/bin/dart_application_1.dart b/bin/dart_application_1.dart index 2404519..5a3d997 100644 --- a/bin/dart_application_1.dart +++ b/bin/dart_application_1.dart @@ -16,6 +16,12 @@ class View { return '$id'; } } +class Text extends View{ +String content; + Text(int id, this.content, {Color? color}) : super(id, color: color); + +} + void main() { /* @@ -26,18 +32,26 @@ void main() { 2) Create new `Text` object with the following: var helloText = Text(, content: 'Hello' ) */ - int id = Random().nextInt(10000); +var helloText = Text( id, 'Hello'); + + print('hello: $helloText'); + task2(); } void task2() { List numbers = List.generate(75, (index) => Random().nextInt(10000)); - + List evenNumbers = []; /* Separate even numbers from the above `numbers` list. List evenNumbers = ... */ + for (int i in numbers){ + if (i %2!=0 ){ + evenNumbers.add(i); + } + } print('evenNumbers: $evenNumbers'); }