get method
Implementation
Future<void> get(String endpoint, Map<String, String> headers) async {
final Uri uri = Uri.parse('$url$endpoint');
try {
final http.Response res = await http.get(
uri,
headers: headers,
);
response = res.body;
httpCode = res.statusCode;
final Map<String, dynamic> jsonResponse = jsonDecode(response!);
errorMessage = jsonResponse['error']?['message'];
messageId = jsonResponse['messages']?[0]?['id'];
phoneNumber = jsonResponse['input']?[0]?['to'];
if (res.statusCode >= 400) {
error = res.reasonPhrase;
}
} catch (e) {
error = e.toString();
}
}