fetchOne method
Implementation
Future<T> fetchOne(String endpoint, int id) async {
final response = await http.get(Uri.parse('$baseUrl/$endpoint/$id'));
if (response.statusCode == 200) {
final Map<String, dynamic> data = json.decode(response.body);
return this.instance.fromJson(data);
} else {
throw Exception('Erro na chamada de serviço: ${response.statusCode}');
}
}