This commit is contained in:
Hamza-Ayed
2024-06-22 13:12:35 +03:00
parent 1cc0156cfd
commit 3c5321f70b
67 changed files with 91 additions and 740 deletions

View File

@@ -46,7 +46,6 @@ class GeminiEgypt extends GetxController {
},
]
});
// print(requestBody);
final response = await http.post(
Uri.parse(
@@ -59,12 +58,8 @@ class GeminiEgypt extends GetxController {
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result = responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -72,22 +67,14 @@ class GeminiEgypt extends GetxController {
if (jsonString != null) {
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
// print(jsonString);
responseIdCardDriverEgypt1 = jsonString;
// print(jsonDecode(responseIdCardDriverEgypt1!));
responseIdCardDriverEgypt = jsonDecode(responseIdCardDriverEgypt1!);
print(responseIdCardDriverEgypt);
update();
return responseIdCardDriverEgypt;
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {}
}
}