Getters and Setters in Dart

class Student {
  String id;
  String name;
  int age;
  double score;

  void set setId(String id) {
    this.id = id;
  }

  String get getId {
    return this.id;
  }

  void set setName(String name) {
    this.name = name;
  }

  String get getName {
    return this.name;
  }

  void set setAge(int age) {
    this.age = age;
  }

  int get getAge {
    return this.age;
  }

  void set setScore(double score) {
    this.score = score;
  }

  double get getScore {
    return this.score;
  }
}

void main() {
  var student = new Student();
  student.setId = "st01";
  student.setName = "name 1";
  student.setAge = 20;
  student.setScore = 6.7;
  print("id: ${student.getId}");
  print("name: ${student.getName}");
  print("age: ${student.getAge}");
  print("score: ${student.getScore}");
}
id: st01
name: name 1
age: 20
score: 6.7