syncra_addons/creche_app/lib/models/class_model.dart

31 lines
588 B
Dart

class ClassModel {
final String id;
final String name;
final int capacity;
final String? teacherId;
ClassModel({
required this.id,
required this.name,
required this.capacity,
this.teacherId,
});
factory ClassModel.fromMap(Map<String, dynamic> map) {
return ClassModel(
id: map['id'] ?? '',
name: map['name'] ?? '',
capacity: map['capacity'] ?? 15,
teacherId: map['teacher_id'],
);
}
Map<String, dynamic> toMap() {
return {
'name': name,
'capacity': capacity,
'teacher_id': teacherId,
};
}
}