diff --git a/CONSOLE_RESULT.png b/CONSOLE_RESULT.png new file mode 100644 index 0000000..b53e1ca Binary files /dev/null and b/CONSOLE_RESULT.png differ diff --git a/bin/dart_application_1.dart b/bin/dart_application_1.dart index 2404519..8f3e885 100644 --- a/bin/dart_application_1.dart +++ b/bin/dart_application_1.dart @@ -17,6 +17,11 @@ class View { } } +class Text extends View { + String content; + Text(int id, {required this.content, Color? color}) : super(id, color: color); +} + void main() { /* 1) Create class named `Text` that extends/inherits `View` class, @@ -28,16 +33,28 @@ void main() { */ int id = Random().nextInt(10000); + Color colorPink = Color(0xffb74093); + String text = + 'When the computer asks "Are you a robot?", maybe, he just wants to find his family?'; + var helloText = Text(id, content: text, color: colorPink); + print('hello: ${helloText.id}\n${helloText.content}'); - print('hello: $helloText'); + task2(); } void task2() { List numbers = List.generate(75, (index) => Random().nextInt(10000)); - /* Separate even numbers from the above `numbers` list. List evenNumbers = ... */ + List evenNumbers = []; + + numbers.forEach((number) { + if (number.isEven) { + evenNumbers.add(number); + } + }); + print('evenNumbers: $evenNumbers'); }