claude refactor
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import '../../../../api/mhsl/customTimetableEvent/customTimetableEvent.dart';
|
||||
import '../../../../api/webuntis/queries/getTimetable/getTimetableResponse.dart';
|
||||
|
||||
sealed class ArbitraryAppointment {
|
||||
const ArbitraryAppointment();
|
||||
|
||||
T when<T>({
|
||||
required T Function(GetTimetableResponseObject lesson) webuntis,
|
||||
required T Function(CustomTimetableEvent event) custom,
|
||||
}) => switch (this) {
|
||||
WebuntisAppointment(:final lesson) => webuntis(lesson),
|
||||
CustomAppointment(:final event) => custom(event),
|
||||
};
|
||||
}
|
||||
|
||||
class WebuntisAppointment extends ArbitraryAppointment {
|
||||
final GetTimetableResponseObject lesson;
|
||||
const WebuntisAppointment(this.lesson);
|
||||
}
|
||||
|
||||
class CustomAppointment extends ArbitraryAppointment {
|
||||
final CustomTimetableEvent event;
|
||||
const CustomAppointment(this.event);
|
||||
}
|
||||
Reference in New Issue
Block a user