passo_mobile_app/lib/sevices/passo/signatories_service.dart

25 lines
783 B
Dart
Raw Normal View History

2023-07-28 02:35:36 +00:00
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:unit2/model/passo/signatories.dart';
class SignatoriesServices {
static final SignatoriesServices _instance = SignatoriesServices();
static SignatoriesServices get instance => _instance;
Future<List<Signatories>> getSignatories() async {
http.Response response = await http.get(
Uri.parse('http://192.168.10.218:8000/api/rptass_app/signatories/'));
print('Signatories');
print(response.statusCode);
if (response.statusCode == 200) {
final List result = jsonDecode(response.body)['data'];
return result.map(((e) => Signatories.fromJson(e))).toList();
} else {
print(response.reasonPhrase);
throw Exception(response.reasonPhrase);
}
}
}