checkNow method
Future<void>
checkNow(
{ - bool allowDuringInstaller = false,
})
Implementation
Future<void> checkNow({bool allowDuringInstaller = false}) async {
if (_disposed) return;
if (_installOperationActive) return;
if (_checking) {
await _checkCompleter?.future;
return;
}
if (_preservesInstallerState && !allowDuringInstaller) {
return;
}
final completer = Completer<void>();
_checkCompleter = completer;
final totalTimer = Stopwatch()..start();
_checking = true;
_setState(
_state.copyWith(
status: NAppUpdateStatus.checking,
clearError: true,
clearProgress: true,
),
);
try {
if (installationEnabled) {
final installedTimer = Stopwatch()..start();
final installed = await installer.getInstalledSoftware();
if (_disposed) return;
_logTiming('installed-package', installedTimer);
_setState(_state.copyWith(installed: installed));
}
final releasesTimer = Stopwatch()..start();
final releases = await ndkFlutter.ndk.software.getReleases(
app: app,
channel: channel,
relays: relays,
timeout: queryTimeout,
);
_logTiming('releases', releasesTimer);
await _evaluate(releases);
} catch (error) {
_fail(error);
} finally {
_checking = false;
if (!completer.isCompleted) completer.complete();
if (identical(_checkCompleter, completer)) _checkCompleter = null;
_logTiming('check-total', totalTimer);
}
}