I am creating a function that would search a query in available statuses’ contents. However, the result does not upload and the following exception is thrown in the terminal:
flutter: error!!! CheckedFromJsonException
flutter: Could not create `_$_Status`.
flutter: There is a problem with "language".
flutter: `sco` is not one of the supported values: aa, ab, ae, af ...
// (just a list of the instance's languages)
I cannot wrap my head around this.
If this is a mismatch of language encoding standards with some other instance, it sure has caught me off guard. I expected the function to load data as intended.
Future<void> fetchPage(int pageKey) async {
try {
final response = await mstdn.v2.search.searchContents(
query: widget.query, type: SearchContentType.statuses);
print(response.data);
List responseList = response.data.statuses as List;
print(responseList);
final postList = responseList
.map((data) => FeedStatusWidget(
statusId: data.id,
))
.toList();
print(postList);
final isLastPage = postList.length < postsPerRequest;
if (isLastPage) {
pagingController.appendLastPage(postList);
debugPrint('Last page');
} else {
final nextPageKey = pageKey + 1;
pagingController.appendPage(postList, nextPageKey);
}
} catch (error) {
debugPrint(
'error!!! $error'); //TODO figure out why the `sco` of all things holy...
pagingController.error = error;
}
}
New contributor
El. K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.