19 lines
391 B
Dart
19 lines
391 B
Dart
|
import 'student.dart';
|
||
|
|
||
|
class University {
|
||
|
List<Student> students = [];
|
||
|
|
||
|
void addStudent(Student student) {
|
||
|
students.add(student);
|
||
|
}
|
||
|
|
||
|
void displayAllStudents() {
|
||
|
for (var student in students) {
|
||
|
student.displayInfo();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
List<Student> getStudentsByCourse(String course) {
|
||
|
return students.where((student) => student.courses.contains(course)).toList();
|
||
|
}
|
||
|
}
|