import 'dart:convert'; import 'package:http/http.dart' as http; import '../constance.dart'; //Not testet becase only wrap around http class HttpConnector { static final String _apiLocation = Constance.apiLocation; Future getAllPlants() async { final url = Uri.parse('$_apiLocation/plants'); final response = await http.get(url); return response; } Future getPlant(int id) async { final url = Uri.parse('$_apiLocation/plants/$id'); final response = await http.get(url); return response; } Future getBeet() async { final url = Uri.parse('$_apiLocation/beet'); final response = await http.get(url); return response; } Future saveBeet(String body) async { final url = Uri.parse('$_apiLocation/beet'); final headers = {'Content-Type': 'application/json'}; final response = await http.post( url, headers: headers, body: utf8.encode(body), ); return response; } }