update method
Liga o serviço (ou atualiza o andamento, se já corre).
Implementation
Future<void> update(int done, int total) => _serial(() async {
final text = total > 0 ? '$done de $total' : 'Preparando…';
final result = await FlutterForegroundTask.isRunningService
? await FlutterForegroundTask.updateService(notificationText: text)
: await FlutterForegroundTask.startService(
serviceId: _serviceId,
serviceTypes: const [ForegroundServiceTypes.dataSync],
notificationTitle: 'Medindo as músicas',
notificationText: text,
);
_report(result);
});