create method
Implementation
Future<T> create(String endpoint, T item) async {
final response = await http.post(
Uri.parse('$baseUrl/$endpoint'),
headers: {'Content-Type': 'application/json'},
body: json.encode(item.toJson()),
);
if (response.statusCode == 201) {
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}');
}
}