duration property

  1. @override
Future<double?> get duration
override

Retrieves the total duration of the audio.

This method sends a request to the platform to retrieve the total duration of the currently playing audio.

Implementation

@override
Future<double?> get duration async {
  try {
    return await methodChannel.invokeMethod<double>('getDuration') ?? 0;
  } on PlatformException catch (e) {
    log("Failed to seekTo: '${e.message}'.");
    return null;
  }
}