stop static method

Future<void> stop()

Stop playback

Implementation

static Future<void> stop() async {
  try {
    // Notify the current listener before disposing, so the playing widget
    // (e.g. SoundMessageWidget) can reset its UI state properly.
    final onComplete = _onComplete;
    _onComplete = null;
    onComplete?.call();

    await _methodChannel.invokeMethod('stop');
    await dispose();
  } catch (e) {
    print('AudioPlayerPlatform.stop error: $e');
  }
}