fix(project): clear dart analyzer issues

This commit is contained in:
Ashley Venn 2026-06-19 15:54:39 -07:00
parent 26db079846
commit 5b20e46987
3 changed files with 17 additions and 13 deletions

View file

@ -1,7 +1,6 @@
/// Public exports for the ADHD scheduling core. // Public exports for the ADHD scheduling core.
/// //
/// Keep this file small. Implementation details belong in `lib/src/`. // Keep this file small. Implementation details belong in `lib/src/`.
library adhd_scheduler_core;
export 'src/models.dart'; export 'src/models.dart';
export 'src/scheduling_engine.dart'; export 'src/scheduling_engine.dart';

View file

@ -181,7 +181,8 @@ class Task {
final TaskStatistics stats; final TaskStatistics stats;
bool get isFlexible => type == TaskType.flexible; bool get isFlexible => type == TaskType.flexible;
bool get isRequiredVisible => type == TaskType.critical || type == TaskType.inflexible; bool get isRequiredVisible =>
type == TaskType.critical || type == TaskType.inflexible;
bool get isLocked => type == TaskType.locked; bool get isLocked => type == TaskType.locked;
bool get isBacklog => status == TaskStatus.backlog; bool get isBacklog => status == TaskStatus.backlog;
@ -213,7 +214,8 @@ class Task {
reward: reward ?? this.reward, reward: reward ?? this.reward,
difficulty: difficulty ?? this.difficulty, difficulty: difficulty ?? this.difficulty,
durationMinutes: durationMinutes ?? this.durationMinutes, durationMinutes: durationMinutes ?? this.durationMinutes,
scheduledStart: clearSchedule ? null : (scheduledStart ?? this.scheduledStart), scheduledStart:
clearSchedule ? null : (scheduledStart ?? this.scheduledStart),
scheduledEnd: clearSchedule ? null : (scheduledEnd ?? this.scheduledEnd), scheduledEnd: clearSchedule ? null : (scheduledEnd ?? this.scheduledEnd),
parentTaskId: parentTaskId ?? this.parentTaskId, parentTaskId: parentTaskId ?? this.parentTaskId,
createdAt: createdAt ?? this.createdAt, createdAt: createdAt ?? this.createdAt,
@ -286,7 +288,7 @@ class TimeInterval {
required this.start, required this.start,
required this.end, required this.end,
this.label, this.label,
}) : assert(!end.isBefore(start), 'end must not be before start'); });
final DateTime start; final DateTime start;
final DateTime end; final DateTime end;

View file

@ -23,7 +23,7 @@ class SchedulingWindow {
const SchedulingWindow({ const SchedulingWindow({
required this.start, required this.start,
required this.end, required this.end,
}) : assert(!end.isBefore(start), 'end must not be before start'); });
final DateTime start; final DateTime start;
final DateTime end; final DateTime end;
@ -63,7 +63,9 @@ class SchedulingInput {
} }
List<Task> get requiredVisibleTasks { List<Task> get requiredVisibleTasks {
return tasks.where((task) => task.isRequiredVisible).toList(growable: false); return tasks
.where((task) => task.isRequiredVisible)
.toList(growable: false);
} }
List<TimeInterval> get flexibleIntervals { List<TimeInterval> get flexibleIntervals {
@ -312,7 +314,8 @@ class SchedulingEngine {
required Duration duration, required Duration duration,
required List<TimeInterval> blocked, required List<TimeInterval> blocked,
}) { }) {
final sortedBlocked = [...blocked]..sort((a, b) => a.start.compareTo(b.start)); final sortedBlocked = [...blocked]
..sort((a, b) => a.start.compareTo(b.start));
var cursor = windowStart; var cursor = windowStart;
for (final interval in sortedBlocked) { for (final interval in sortedBlocked) {
@ -327,7 +330,8 @@ class SchedulingEngine {
} }
final candidateEnd = cursor.add(duration); final candidateEnd = cursor.add(duration);
if (candidateEnd.isBefore(windowEnd) || candidateEnd.isAtSameMomentAs(windowEnd)) { if (candidateEnd.isBefore(windowEnd) ||
candidateEnd.isAtSameMomentAs(windowEnd)) {
return TimeInterval(start: cursor, end: candidateEnd); return TimeInterval(start: cursor, end: candidateEnd);
} }
@ -420,8 +424,7 @@ _BacklogInsertionPlan? _planBacklogInsertion({
} }
final startsBeforeWindow = interval.start.isBefore(input.window.start); final startsBeforeWindow = interval.start.isBefore(input.window.start);
final startsAfterWindow = final startsAfterWindow = interval.start.isAfter(input.window.end) ||
interval.start.isAfter(input.window.end) ||
interval.start.isAtSameMomentAs(input.window.end); interval.start.isAtSameMomentAs(input.window.end);
if (startsBeforeWindow || startsAfterWindow) { if (startsBeforeWindow || startsAfterWindow) {