showUpdateDialog method

Future<void> showUpdateDialog(
  1. UpdateInfo updateInfo, [
  2. BuildContext? context
])

Show update dialog manually

If context is not provided, will try to use the navigator key or find root navigator

Implementation

Future<void> showUpdateDialog(
  UpdateInfo updateInfo, [
  BuildContext? context,
]) async {
  AppLogger.info('Manually showing update dialog', 'AppHubUpgrader');

  final dialogContext = _getValidContext(context);
  if (dialogContext == null || !dialogContext.mounted) {
    AppLogger.error(
      'Cannot show dialog - no valid context available. '
          'Please provide a BuildContext or GlobalKey for NavigatorState',
      null,
      'AppHubUpgrader',
    );
    return;
  }

  await _showUpdateDialog(dialogContext, updateInfo);
}