getMyFeedback method

Future<List<BFeedback>> getMyFeedback()

Implementation

Future<List<BFeedback>> getMyFeedback() async {
  //
  final mineUrl = BytedeskUtils.getHostUri(
      '/api/feedback/mine', {'client': client});
  debugPrint("getMyFeedback Url $mineUrl");
  final initResponse = await httpClient.get(mineUrl, headers: getHeaders());
  //解决json解析中的乱码问题
  Utf8Decoder utf8decoder = const Utf8Decoder(); // fix 中文乱码
  //将string类型数据 转换为json类型的数据
  final responseJson =
      json.decode(utf8decoder.convert(initResponse.bodyBytes));
  debugPrint("getMyFeedback: $responseJson");
  //
  List<BFeedback> myfeedbacks = (responseJson['data']['content'] as List<dynamic>)
      .map((item) => BFeedback.fromJson(item))
      .toList();

  return myfeedbacks;
}