news.dart 690B

1234567891011121314151617181920212223242526272829
  1. import 'package:dio/dio.dart';
  2. import 'package:farmer_client/utils/Request.dart';
  3. import 'package:fluttertoast/fluttertoast.dart';
  4. /**
  5. * 农机资讯
  6. * @param {*} data
  7. * @returns
  8. */
  9. Future getNewsList(params) async {
  10. return request('/news', options: Options(method: 'GET'),queryParameters: params)
  11. .catchError((error) => {
  12. Fluttertoast.showToast(msg: error.error['message']),
  13. });
  14. }
  15. /**
  16. * 农机资讯详情
  17. * @param {*} data
  18. * @returns
  19. */
  20. Future getNewsInfo(String id) async {
  21. return request(
  22. '/news/$id',
  23. options: Options(method: 'GET'),
  24. ).catchError((error) => {
  25. Fluttertoast.showToast(msg: error.error['message']),
  26. });
  27. }