setAsset method Null safety

Future<Duration?> setAsset(
  1. String assetPath,
  2. {bool preload = true,
  3. Duration? initialPosition}
)

Convenience method to set the audio source to an asset, preloaded by default, with an initial position of zero by default.

setAudioSource(AudioSource.uri(Uri.parse('asset:///$assetPath')),
    initialPosition: Duration.zero, preload: true);

See setAudioSource for a detailed explanation of the options.

Implementation

Future<Duration?> setAsset(
  String assetPath, {
  bool preload = true,
  Duration? initialPosition,
}) =>
    setAudioSource(AudioSource.uri(Uri.parse('asset:///$assetPath')),
        initialPosition: initialPosition, preload: preload);