create static method
Future<AudioPool>
create({
- required Source source,
- required int maxPlayers,
- AudioCache? audioCache,
- int minPlayers = 1,
Creates an AudioPool instance with the given parameters.
Implementation
static Future<AudioPool> create({
required Source source,
required int maxPlayers,
AudioCache? audioCache,
int minPlayers = 1,
}) async {
final instance = AudioPool._(
source: source,
audioCache: audioCache,
maxPlayers: maxPlayers,
minPlayers: minPlayers,
);
final players = await Future.wait(
List.generate(minPlayers, (_) => instance._createNewAudioPlayer()),
);
return instance..availablePlayers.addAll(players);
}