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
27 changes: 10 additions & 17 deletions bin/dart_application_1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,20 @@ class View {
}
}

void main() {
/*
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:
var helloText = Text(<random id>, content: 'Hello' )
*/
class Text extends View{
String content;
Text(int id, this.content, {Color? color}) : super(id, color: color);
}

void main() {
int id = Random().nextInt(10000);

Text helloText = Text (id, 'Hello', );
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 = ...
*/
print('evenNumbers: $evenNumbers');
}
List<int> evennumbers = numbers.where((enumber) => enumber % 2 == 0).toList();
print('evennumbers: $evennumbers');
}
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.