destroy method

Future destroy()

Implementation

Future<dynamic> destroy() async {
  _downloadStream = null;
  _durationStream = null;
  _fftStream = null;
  _playStateStream = null;

  for (var item in _subscription) {
    item.cancel();
  }

  removePlayBackEvent();

  events = {};

  var result = await _channel?.invokeMethod('destroy');
  var response = PluginResultModel.fromMap(result);

  if (response.isError) {
    return Future.error(Exception(response.message));
  }

  return response.data;
}