stopService static method
Stop the foreground service.
Implementation
static Future<bool> stopService() async {
// If the service is not running, the stop function is not executed.
if (!await isRunningService) return false;
_removePort();
final bool result =
await _methodChannel.invokeMethod('stopForegroundService');
if (result) {
_printMessage('FlutterForegroundTask has stopped.');
return true;
}
return false;
}