11:40 pm. Someone opens a sleep app, picks heavy rain with rolling thunder underneath, sets a 30-minute timer and locks the phone.
From that moment the app has three jobs. Keep playing with the screen off. Get out of the way when something more important happens. And stop when it was told to stop, not at 4 am.
Zenith is our Flutter template for sleep, focus and breathing apps, built with Riverpod 3. This post follows that one night, but first there was a decision we had to make before any of it: where the audio lives.
Before the night: stream it, list it in JSON
Zenith has 45 tracks: 15 ambient sounds, 10 mood tracks and 20 Lofi radio tracks. None of them are packaged inside the app. They're streamed from cloud storage, which keeps the download small.
The catalogue itself is plain JSON in assets/data .…