dart format
This commit is contained in:
@@ -9,10 +9,14 @@ import '../queries/get_subjects/get_subjects_response.dart';
|
||||
/// When a record is missing the resolver returns a placeholder fallback
|
||||
/// instead of `null` so call sites stay branch-free.
|
||||
class LessonResolver {
|
||||
static GetSubjectsResponseObject resolveSubject(TimetableState state, int? id) {
|
||||
static GetSubjectsResponseObject resolveSubject(
|
||||
TimetableState state,
|
||||
int? id,
|
||||
) {
|
||||
final fallback = GetSubjectsResponseObject(0, '?', 'Unbekannt', '?', true);
|
||||
if (id == null) return fallback;
|
||||
return state.subjects?.result.firstWhereOrNull((s) => s.id == id) ?? fallback;
|
||||
return state.subjects?.result.firstWhereOrNull((s) => s.id == id) ??
|
||||
fallback;
|
||||
}
|
||||
|
||||
static GetRoomsResponseObject resolveRoom(TimetableState state, int? id) {
|
||||
@@ -61,9 +65,7 @@ class LessonFormatter {
|
||||
/// optional longname (rendered in parentheses if it differs from `name`),
|
||||
/// and optional extra info (joined with `·`).
|
||||
static String formatLine(String name, {String? longname, String? extra}) {
|
||||
final parts = <String>[
|
||||
if (name.isNotEmpty) name else '?',
|
||||
];
|
||||
final parts = <String>[if (name.isNotEmpty) name else '?'];
|
||||
final ln = (longname ?? '').trim();
|
||||
if (ln.isNotEmpty && ln != name) parts.add('($ln)');
|
||||
final ex = (extra ?? '').trim();
|
||||
|
||||
Reference in New Issue
Block a user