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 map) { return ClassModel( id: map['id'] ?? '', name: map['name'] ?? '', capacity: map['capacity'] ?? 15, teacherId: map['teacher_id'], ); } Map toMap() { return { 'name': name, 'capacity': capacity, 'teacher_id': teacherId, }; } }