Flutter 显示黑白表情符号,但同样在终端上也能正常工作,就像预期的那样

Flutter shows black & white emoji, but the same works fine on terminal just like expected

提问人:Jill Clover 提问时间:10/2/2023 更新时间:10/2/2023 访问量:36

问:

扑动:

enter image description here

终端:enter image description here

如何解决这个问题?

  fetchFeed() async {
    try {
      final response = await http.get(
        Uri.parse('http://localhost:8080/'),
        headers: {'Content-Type': 'application/json; charset=UTF-8'},
      );
      if (response.statusCode == 200) {
        final List<dynamic> body = json.decode(utf8.decode(response.bodyBytes));
        setState(() {
          feedData =
              body.map((dynamic item) => FeedItem.fromJson(item)).toList();
        });
      }
      print(response.body);
      print(response.statusCode);
    } catch (e) {
      print("Error: $e");
    }
  }
Flutter Dart UTF-8 符号

评论

0赞 Dhafin Rayhan 10/2/2023
这可能与 stackoverflow.com/a/70615778/13625293 有关

答: 暂无答案