icon method

String? icon(
  1. PendingTask pending, {
  2. required String? loading,
})

Implementation

String? icon(
  PendingTask pending, {
  required String? loading,
}) {
  return switch (null) {
    _ when pending.isError => red.wrap(x),
    _ when pending.hasCompleted => green.wrap(checkMark),
    _ when pending.isHalted => blue.wrap(dot),
    _ when pending.files.isEmpty => yellow.wrap(down),
    _ when pending.subTasks.isNotEmpty => yellow.wrap(right),
    _ when !pending.hasStarted => yellow.wrap(waiting),
    _ when pending.isRunning => yellow.wrap(loading),
    _ => red.wrap(warning),
  };
}