From 82b716a0e607da92ef00e304cbd8fb572af308f8 Mon Sep 17 00:00:00 2001 From: "J. A. Messias" Date: Mon, 11 Nov 2024 10:35:12 -0300 Subject: [PATCH] =?UTF-8?q?fix=20sele=C3=A7=C3=A3o=20de=20locais=20sem=20c?= =?UTF-8?q?onex=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/localization/localization_service.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/shared/services/localization/localization_service.dart b/lib/shared/services/localization/localization_service.dart index 7e716409..92ff9604 100644 --- a/lib/shared/services/localization/localization_service.dart +++ b/lib/shared/services/localization/localization_service.dart @@ -21,11 +21,19 @@ class LocalizationService { try { final GetLocalsCall callback = PhpGroup.getLocalsCall; var response = await callback.call(); - final bool isError = response.jsonBody['error']; + final bool? isError = response.jsonBody['error']; - if (isError) { + if (isError == true) { _handleError(context, response.jsonBody['error_msg']); return; + } + if (isError == null) { + final String errorMsg = FFLocalizations.of(context).getVariableText( + enText: 'Verify your connection', + ptText: 'Verifique sua conexão', + ); + DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context)); + return; } final List locals = response.jsonBody['locais'] ?? [];