Skip to content
Open
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
40 changes: 26 additions & 14 deletions bin/dart_application_1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,46 @@ class View {
Color? color;

View(this.id, {this.color});

@override
String toString() {
return '$id';
}
}

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.
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:
2) Create new Text object with the following:
var helloText = Text(<random id>, content: 'Hello' )
*/

int id = Random().nextInt(10000);
int textid= Random().nextInt(10000);
text hellotext =text(textid ,'hello');
var helloText;
print('hello: ${helloText}');
int id = Random().nextInt(10000);
print('hello:${hellotext}');

print('hello: $helloText');
}

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');
import "dart:math";
List<int> numbers = List.generate(75, (index) => Random().nextInt(10000));
int i=0;
List evenNumbers=[];

for(i in numbers);{
if(i%2==0);{
evenNumbers.add(i);
print(evenNumbers);
}
}
print('evenNumbers : ${evenNumbers}');
}