Skip to content

Commit

Permalink
Dart uptodate
Browse files Browse the repository at this point in the history
  • Loading branch information
atish-pun committed Jun 29, 2021
1 parent d075187 commit 054d2d5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions Constructor.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
void main() {
//static method calling from class itself
Student.getResults();

//named constructor with marksdetails as name
Student s = new Student(name: "Atish", roll: 2);

Student std = new Student.classname([1, 2, 3, 4]);
std.showclass();
}

class Student {
//properties
late int roll;
late String name;
late int classid;
late bool isMale;
List<int> marks = [];

//constructor
Student({this.roll = 1, this.name = "ram"});

Student.classname(this.marks);

//methods which denotes the behaviours of the class objects.
static void getResults() {
print("i am static method");
}

void showclass() {
print("This is marks: ${this.marks}");
print("This is name: $name and roll.no: $roll");
}
}
2 changes: 1 addition & 1 deletion calculator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void main() {
cal.sub(a: firstNum, b: secondNum);
cal.mult(a: firstNum, b: secondNum);
cal.div(a: firstNum, b: secondNum);
} on FormatException catch (number) {
} on FormatException {
print("Invlaid number format in input field");
} catch (error) {
print(error);
Expand Down

0 comments on commit 054d2d5

Please sign in to comment.