setFilePath method Null safety

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

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

setAudioSource(AudioSource.uri(Uri.file(filePath)),
    initialPosition: Duration.zero, preload: true);

See setAudioSource for a detailed explanation of the options.

Implementation

Future<Duration?> setFilePath(
  String filePath, {
  Duration? initialPosition,
  bool preload = true,
}) =>
    setAudioSource(AudioSource.uri(Uri.file(filePath)),
        initialPosition: initialPosition, preload: preload);