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)
有人可以帮助我改进搜索系统吗?