如何使用颤振在 firebase firestore 中制作搜索数组?

时间:2021-07-27 12:30:42

标签: flutter google-cloud-firestore

enter image description here我的代码是这样的:

 String search = '';
    String searchKeys = selectedWork.toString();

    for (int i = 0; i <= searchKeys.length; i++) {
      search += searchKeys[i];
      print(search);
    }

    posts
        .doc(FirebaseAuth.instance.currentUser!.uid)
        .collection('userPosts')
        .add(
      {
        'search': [search],
      },
    );

但这给出了错误: RangeError (RangeError (index): Invalid value: Not in inclusive range 0..15: 16)

有人可以帮助我改进搜索系统吗?

0 个答案:

没有答案