# Tasks: Startup retry, custom stations, and equalizer persistence ## Phase 1: Test seams and RED tests - [x] 1.1 RED: Add `test/servicios/servicio_radio_test.dart` proving a transient HTTP failure retries with another host and succeeds. - [x] 1.2 RED: Add `test/servicios/servicio_radio_test.dart` proving exhausted retries surface an error after the configured attempt cap. - [x] 1.3 RED: Add `test/estado/estado_radio_test.dart` proving a saved custom station is included in the main listing getter. - [x] 1.4 RED: Add `test/estado/estado_radio_test.dart` proving main EQ loads from persistence before playback EQ selection. - [x] 1.5 RED: Add station EQ tests proving own EQ overrides main and disabled own EQ falls back to main. - [x] 1.6 RED: Add/update a widget test proving `PantallaInicio` renders custom stations and favorite tap calls the favorite flow. ## Phase 2: Foundation / services - [x] 2.1 GREEN: Modify `ServicioRadio` to accept injectable `http.Client`, host list, max attempts, and retry delay while preserving default constructor behavior. - [x] 2.2 GREEN: Implement bounded retry/host rotation in `ServicioRadio._get()` without adding unbounded startup waits. - [x] 2.3 GREEN: Create `lib/servicios/servicio_ecualizador.dart` with SharedPreferences JSON load/save for main EQ and per-station EQ map. - [x] 2.4 GREEN: Add equality/copy helpers to `PresetEcualizador` only if required by tests. ## Phase 3: State integration - [x] 3.1 GREEN: Update `EstadoRadio` constructor for optional service injection and load EQ config during `_init()`. - [x] 3.2 GREEN: Add a combined main listing getter (`emisorasInicio` or equivalent) that includes custom stations plus API stations without duplicates. - [x] 3.3 GREEN: Persist main EQ changes when no station-own EQ scope is active. - [x] 3.4 GREEN: Add methods to enable/update/disable EQ per favorite station and persist the map. - [x] 3.5 GREEN: Change playback EQ selection to apply station EQ when present, otherwise main EQ. ## Phase 4: UI wiring - [x] 4.1 GREEN: Update `PantallaInicio` to render the combined main listing when no genre filter is selected. - [x] 4.2 GREEN: Reuse `TarjetaEmisora` favorite controls for custom stations; do not introduce a parallel favorite path. - [x] 4.3 GREEN: Update `PantallaAjustes` EQ controls to show/edit main EQ and, when the current station is a favorite, allow own-EQ vs main-EQ mode. - [x] 4.4 GREEN: Fix `ServicioAudio`/handler so `emisoraActual` is set on successful playback and cleared on stop/error as tests require. ## Phase 5: REFACTOR and verification - [x] 5.1 REFACTOR: Remove duplicated JSON/persistence logic from `EstadoRadio` where the new service owns it. - [x] 5.2 REFACTOR: Keep Spanish naming and Provider/ChangeNotifier style consistent with existing folders. - [ ] 5.3 VERIFY: Run `flutter test` only; never run `flutter build`. - [ ] 5.4 VERIFY: Compare passing tests against every Given/When/Then scenario in `spec.md`.