import '../data/model/SysConfig.dart'; import 'dio_client.dart'; class ApiService { static final ApiService _instance = ApiService._internal(); final DioClient _dioClient = DioClient(); factory ApiService() => _instance; ApiService._internal(); Future fetchSysConfig(String path) async { try { final Map data = await _dioClient.get(path); return SysConfig.fromJson(data); } catch (e) { throw Exception('Failed to fetch user: $e'); } } Future> fetchData(String path, {Map? queryParameters}) async { return await _dioClient.get(path, queryParameters: queryParameters); } Future> createData(String path, {Map? data}) async { return await _dioClient.post(path, data: data); } Future> updateData(String path, {Map? data}) async { return await _dioClient.put(path, data: data); } Future downloadFile(String urlPath, String savePath) async { await _dioClient.download(urlPath, savePath); } }