cancel method

  1. @override
Future<void> cancel()
override

The run() function will keep running until we interrupt it here and it will stop listening to audio

Implementation

@override
Future<void> cancel() async {
  currentState = ApplicationState.ready;
  if (mounted) setState(() {});
}