Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ApiService {
- final String baseUrl = "http://192.168.100.94:5000";
- Client client = Client();
- Future<List<Vendor>> getVendors() async {
- final response = await client.get("$baseUrl/api/vendor");
- if (response.statusCode == 200) {
- return vendorFromJson(response.body);
- } else {
- return null;
- }
- }
- Future<bool> createVendor(Vendor data) async {
- final response = await client.post(
- "$baseUrl/api/vendor",
- headers: {"content-type": "application/json"},
- body: vendorToJson(data),
- );
- if (response.statusCode == 201) {
- return true;
- } else {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement