X-Git-Url: https://hackdaworld.org/gitweb/?p=outofuni%2Ftavern2.git;a=blobdiff_plain;f=lib%2Fproduct_service.dart;fp=lib%2Fproduct_service.dart;h=0ffe964b17c0038520314349e0d6ffa1b3077071;hp=41af5cb9e3f81ad1d3c8cffeed3dc09397cc1d4c;hb=b2028ca4879e48884436ee0c2aee7fae6ddaeb5a;hpb=3307c69f4b16867ba7522626b6b0acf2d6d9a478 diff --git a/lib/product_service.dart b/lib/product_service.dart index 41af5cb..0ffe964 100644 --- a/lib/product_service.dart +++ b/lib/product_service.dart @@ -60,7 +60,7 @@ class ProductService { Future 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({ @@ -70,6 +70,7 @@ class ProductService { 'category': cat }) ); + return(JSON.decode(response.body)['id']); } catch(e) { throw _handleError(e);