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
6 changes: 0 additions & 6 deletions README.md

This file was deleted.

37 changes: 23 additions & 14 deletions bin/dart_application_1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,36 @@ class View {
}
}

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.
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' )
*/


int id = Random().nextInt(10000);

print('hello: $helloText');
var helloText = Text(id, "hussain alyasiry");

print('Hello: $helloText');
//the output is Hello: 7303
// it changes with every run
task2();
// for printing the evennumbers
}

void task2() {
List<int> numbers = List.generate(75, (index) => Random().nextInt(10000));
List evenNumbers = [];

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


for (final i in numbers) {
if (i.isEven) {
evenNumbers.add(i);
}
}
print('evenNumbers: $evenNumbers');
// the output is evenNumbers: [5846, 7814, 3402, 7126, 880, 5084, 2842, 9076, 2786, 6628, 6, 1666, 7590, 4504, 7796, 9400, 5784, 8048, 7962, 4236, 7318, 6112, 640, 5404, 9790, 9008, 1928, 388, 5942, 4250, 8156, 9284, 3154, 5408]
// and it changes with every run
}
Binary file removed errors_in_dart_application_1.dart.png
Binary file not shown.