getNonce function
Implementation
Future<void> getNonce(url) async {
final response = await http.get(Uri.parse(url), headers: {
'Content-Type': 'application/json',
});
if (response.statusCode == 200) {
// If the server returns a 200 OK response, parse the data
var data = response.body;
nonce = data;
} else {
// If the server returns an error response, throw an exception
throw Exception('Failed to load data from backend');
}
}