import 'package:http/http.dart' as http;
Future<Map<String, dynamic>> pingDemoAccu360() async {
final url = Uri.parse('https://demo.accu360.co.in');
try {
// Send a GET request to check if the server is reachable
final response = await http.get(url);
// Check if the response status is 200 (OK)
if (response.statusCode == 200) {
// If the server responds successfully, return success in the FlutterFlow-compatible format
return {
'status': 'success',
'message': 'Ping is success', // Return the success message
};
} else {
// If the server responds with an error, return the error status and message
return {
'status': 'error',
'message': 'Failed to ping: ${response.statusCode}', // Return the error message with the status code
};
}
} catch (e) {
// If there's an exception (e.g., no network), catch the error
return {
'status': 'error',
'message': 'An error occurred: $e', // Return the error message
};
}
}
Unable to process the return parameter
General Conversations
1