Advertisement
fauzie811

apiTamu.dart

Dec 3rd, 2021 (edited)
967
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.50 KB | None | 0 0
  1. import 'dart:convert';
  2. import 'package:qrcode2/model/undangan.dart';
  3. import 'package:http/http.dart' as http;
  4.  
  5. class ApiUndangan {
  6.   static Future<Undangan?> cekUndangan(String sid) async {
  7.     final response = await http.post(
  8.         Uri.parse('https://tamu.id/admin/api-slogin'),
  9.         body: {'sid': sid});
  10.  
  11.     if (response.statusCode == 200) {
  12.       return Undangan.fromJson(jsonDecode(response.body));
  13.     } else {
  14.       print('error ${response.body}');
  15.       return null;
  16.     }
  17.   }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement