Mujiburrohman

APiService

Jun 14th, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.45 KB | None | 0 0
  1. import 'package:crud_flutter/model/barang.dart';
  2. import 'package:http/http.dart' show Client;
  3.  
  4. class ApiService {
  5.   final String baseUrl = "http://192.168.1.17/api_barang/index.php/Api/";
  6.   Client client = Client();
  7.  
  8.   Future<List<Barang>> geBarang() async{
  9.     final response = await client.get("$baseUrl/getBarang");
  10.     if(response.statusCode == 200){
  11.       return barangFromJson(response.body);
  12.     }else{
  13.       return null;
  14.     }
  15.   }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment