stop static method
Stops the background service.
This will signal the processing loop to cease and then stop the service itself. It also attempts to close the background database connection.
Implementation
static Future<void> stop() async {
if (await _service.isRunning()) {
_service.invoke("stopProcessing"); // Signal processing loop to stop
// Give it a moment to process the stop signal before stopping the service itself
await Future.delayed(const Duration(seconds: 1));
_service.invoke(
"stopSelf",
); // This is an internal command for the service
log('BackgroundService: Stop requested.');
}
}