getUser method
Retrieves a user with the given userID
from the API.
Returns the user object if the API call is successful.
Implementation
Future<User> getUser(int userID) async {
final response = await callApi(endpoint: 'users/$userID', method: 'get');
if (response.statusCode == 200) {
final responseData = json.decode(response.body);
final user = User.fromJson(responseData);
return user;
} else {
throw Exception(response);
}
}