Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added CONSOLE_RESULT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 19 additions & 2 deletions bin/dart_application_1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<int> numbers = List.generate(75, (index) => Random().nextInt(10000));

/*
Separate even numbers from the above `numbers` list.
List<int> evenNumbers = ...
*/
List<int> evenNumbers = [];

numbers.forEach((number) {
if (number.isEven) {
evenNumbers.add(number);
}
});

print('evenNumbers: $evenNumbers');
}