onStop method
Callback when this executor is stopped. Returns true if successfully stopped, false otherwise.
Implementation
@override
Future<bool> onStop() async {
// when stopping the audio sampling, stop recording and collect the datum
if (_isRecording) {
try {
await _stopAudioRecording();
final measurement = await getMeasurement();
if (measurement != null) addMeasurement(measurement);
debug('Audio recording paused - sound file : $_soundFileName');
} catch (error) {
warning('An error occurred trying to stop audio recording - $error');
addError(error);
}
}
return true;
}