fetchSingle method

  1. @override
Future<AudioResolverResult?> fetchSingle({
  1. required String videoId,
  2. bool forceRefresh = false,
})
override

Resolve a single video ID to an audio URL.

Implementation

@override
Future<AudioResolverResult?> fetchSingle({
  required String videoId,
  bool forceRefresh = false,
}) async {
  try {
    final result = await methodChannel.invokeMethod<Map<dynamic, dynamic>>(
      'fetchSingle',
      {
        'videoId': videoId,
        'forceRefresh': forceRefresh,
      },
    );
    if (result == null) return null;
    return AudioResolverResult.fromMap(result.cast<String, dynamic>());
  } on PlatformException catch (e) {
    throw _handleError(e);
  }
}