Future<Null> createProduct(String name,double price,String cat) async {
try {
var url=_server+'/'+_db;
- await _http.post(
+ var response = await _http.post(
url,
headers: {'Content-Type': 'application/json'},
body: JSON.encode({
'category': cat
})
);
+ return(JSON.decode(response.body)['id']);
}
catch(e) {
throw _handleError(e);