Fix Flutter transaction anomaly detection request handling
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 70/100
Piste de recherche
Examinez le fichier pubspec.yaml de l'application Flutter pour vous assurer que le package http est listé. Trouvez le fichier avec l'importation 'import "http" as http;' et modifiez-la en 'import "package:http/http.dart" as http;'. Localisez ensuite la fonction de requête de détection d'anomalie de transaction et ajoutez la gestion des erreurs pour les réponses non 2xx, les erreurs réseau et l'analyse JSON. Assurez-vous que l'URL de base de l'API est configurable, peut-être via une variable d'environnement ou un fichier de configuration. Testez en exécutant l'application et en simulant des échecs d'API.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Short summary
Flutter transaction anomaly detection request fails to compile and cannot be reliably exercised because the HTTP client import is invalid and request failures are not handled.
Affected version or release
Not specified in the source report; the affected application is a Flutter app using a development API endpoint.
Installation context
Flutter application using the AI Shield India transaction flow; requests target the development API endpoint at 10.0.2.2:8000.
What happened?
The Flutter application imports the HTTP client as import 'http' as http;, but the code calls http.post. This import does not reference the package library and prevents the app from compiling unless corrected to import 'package:http/http.dart' as http; and the http dependency is declared in pubspec.yaml. After compilation is fixed, the transaction flow should handle non-2xx responses, network and timeout failures, and invalid JSON without crashing. The API base URL should also be configurable for emulator, device, and production environments.
Steps to reproduce
- Create or open the Flutter application containing the AI Shield transaction flow.
- Ensure the code contains the HTTP import
import 'http' as http;and callshttp.post. - Run the application or compile the project.
- After correcting the import, invoke the Test High-Value Transfer action with the development API unavailable or returning an error.
- Observe the compilation failure or unhandled request/JSON failure.
Expected behavior
The app should compile with the HTTP package configured, send the transaction request successfully when the API is available, and show a user-friendly error when the API returns a non-2xx response, times out, cannot be reached, or returns invalid JSON. The API base URL should be configurable per environment.
Additional context
The original implementation uses http://10.0.2.2:8000/api/v1/detect-anomaly, which is emulator-specific and uses cleartext HTTP. Confirm the Android network-security configuration or migrate the endpoint to HTTPS. The request includes user ID, amount, current and previous locations, and screen-sharing state.
- Langage dominant
- Aucune donnée de langage
- Étoiles
- 2.1k
- Forks
- 157
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de github/app
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
When using GPT-5. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
Toutes les issues de github/app
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Richie97/track-history#325 ·
-
KW-related Type:bug UI / UX
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Bolus validation button text Ouverteneeds-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
nightscout/Trio#1574 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
TencentCloud/Octop#1124 ·