TDLib电报数据库库上的 Flutter 端口中的 GetChats 类返回一个空列表

问题描述

我在使用上述方法时遇到问题,它按预期返回给我一个列表,但 chatId 为空。这是我的代码

Future<String> _getChats() async {

    final result = await context.read<TelegramService>().send(
        TdApi.GetChats(limit: 999),);

    TdApi.Chats chats = result;

    print(chats.totalCount);

    contacts.clear();

    print(chats.chatIds);

    for (var i = 0; i < chats.totalCount; i++) {
      final result = await context.read<TelegramService>().send(TdApi.GetChat(chatId: chats.chatIds[i]),);

      print(result);

      TdApi.Chat chat = result;

      final contact = TextButton(
        onpressed: () {
          locator<NavigationService>().navigateto(route);
          Variables.setContactName(chat.title);
          Variables.setContactID(chat.id);
        },child: Text(chat.title),);

      contacts.add(contact);

    }
    String state = "Contacts Retrieved ";
    return state;
  }

这是我使用的库端口的链接 https://pub.dev/packages/tdlib。其他方法在相同的原理下工作得很好,但是,这不行。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)