Bgm constructor
Bgm({
- AudioCache? audioCache,
The looping background music class.
This class helps with looping background music management that reacts to application lifecycle state changes. On construction, the instance is added as an observer to the WidgetsBinding instance. A dispose function is provided in case this functionality needs to be unloaded but the app needs to keep running.
Implementation
Bgm({AudioCache? audioCache})
: audioPlayer = AudioPlayer()
..audioCache = audioCache ?? AudioCache.instance;