25 lines
681 B
Dart
25 lines
681 B
Dart
import 'dart:developer';
|
|
|
|
import 'package:ticket_booth/model/layanan.dart';
|
|
|
|
import '../app/constant.dart';
|
|
import 'base_repository.dart';
|
|
|
|
class ServiceRepository extends BaseRepository {
|
|
ServiceRepository({required super.dio});
|
|
Future<List<Layanan>> getData({required String hostIp}) async {
|
|
final url =
|
|
"$hostIp/one-api/mockup/masterdata/one-md-fo-service/service/listService";
|
|
print(url);
|
|
final resp = await getService(service: url);
|
|
|
|
final List<Layanan> listLayanan = List.empty(growable: true);
|
|
|
|
resp['data']['records'].forEach((e) {
|
|
final model = Layanan.fromJson(e);
|
|
listLayanan.add(model);
|
|
});
|
|
return listLayanan;
|
|
}
|
|
}
|