我正在尝试根据 category_type 检索条目列表,但出现以下异常:
I/flutter ( 8486): Cannot get list of entries. Finished with error: {
I/flutter ( 8486): "sys": {
I/flutter ( 8486): "type": "Error",
I/flutter ( 8486): "id": "NotFound"
I/flutter ( 8486): },
I/flutter ( 8486): "message": "The resource could not be found.",
I/flutter ( 8486): "requestId": "883045ce-dcc2-4187-ab1d-28c57ad18756"
I/flutter ( 8486): }
I/flutter ( 8486): null
这是调用代码:
Future<List<Category>> getCategories() async {
try {
final entries = await _contentfulClient.getEntries<Category>(
params: {
'content_type': 'category',
'skip': '0',
'limit': '100',
'order': 'sys.createdAt',
},
);
return entries.items.asList();
} catch(exception){
print(exception.message);
}
}
content_type 名称正确,拼写没有错误。
我尝试了不同的代码来获取有关我尝试访问的空间的信息,并且效果很好:
Future<Space> getCurrentSpaceDetails() async {
try {
return await _contentfulClient.getSpaceDetails(
spaceid: Secrets.CONTENTFUL_SPACE_ID);
} on ContentfulError catch (error) {
throw ContentfulError(message: error.message);
}
}
输出:
I/flutter ( 8486): Space {
I/flutter ( 8486): sys=SystemFields {
I/flutter ( 8486): id=5k4zwxslsof9,
I/flutter ( 8486): type=Space,
I/flutter ( 8486): },
I/flutter ( 8486): locales=[Locale {
I/flutter ( 8486): code=en-US,
I/flutter ( 8486): name=English (United States),
I/flutter ( 8486): isDefault=true,
I/flutter ( 8486): }],
I/flutter ( 8486): name=afro-quiz,
I/flutter ( 8486): }
所以我认为这与安装没有任何关系。
我正在使用contentful_dart 0.0.5
依赖项