Overview
This issue describes the plan to replace flutter_background_service with audio_service as the background execution mechanism.
The current implementation uses flutter_background_service. It uses SQFlite for passing interval data, SharedPreferences for the pause flag, and service events (service.invoke("stop");). Migrating to audio_service will replace these with a single Dart stream.
audio_service
Tutorial.
audio_service is built for long-running audio. It registers the app with the OS as a media player, which grants it a foreground service slot and lock-screen controls without any extra configuration. The BaseAudioHandler subclass runs in the same Dart isolate as the UI, so the interval list can be passed by reference in memory.
Design
HiitAudioHandler - Extends the BaseAudioHandler class. Defines pause/play/skip, playSound, broadcasts state. This will replace flutter_background_service.
Countdown - Stateful widget, contains the streambuilder.
CountdownController - Public-facing controller that translates user calls into handler methods.
IntervalType - Unchanged.
TimerState - Unchanged.
Overview
This issue describes the plan to replace
flutter_background_servicewithaudio_serviceas the background execution mechanism.The current implementation uses flutter_background_service. It uses SQFlite for passing interval data, SharedPreferences for the pause flag, and service events (
service.invoke("stop");). Migrating to audio_service will replace these with a single Dart stream.audio_service
Tutorial.
audio_serviceis built for long-running audio. It registers the app with the OS as a media player, which grants it a foreground service slot and lock-screen controls without any extra configuration. The BaseAudioHandler subclass runs in the same Dart isolate as the UI, so the interval list can be passed by reference in memory.Design
HiitAudioHandler- Extends theBaseAudioHandlerclass. Defines pause/play/skip, playSound, broadcasts state. This will replace flutter_background_service.Countdown- Stateful widget, contains the streambuilder.CountdownController- Public-facing controller that translates user calls into handler methods.IntervalType- Unchanged.TimerState- Unchanged.