getQuestions method

  1. @override
Future<List<RobotoffQuestion>> getQuestions(
  1. LocalDatabase localDatabase,
  2. int count
)
override

Implementation

@override
Future<List<RobotoffQuestion>> getQuestions(
  LocalDatabase localDatabase,
  int count,
) async {
  final RobotoffQuestionResult result =
      await RobotoffAPIClient.getProductQuestions(
        barcode,
        ProductQuery.getLanguage(),
        count: count,
        uriHelper: ProductQuery.uriRobotoffHelper,
      );
  if (result.questions?.isNotEmpty != true) {
    return <RobotoffQuestion>[];
  }
  await ProductRefresher().silentFetchAndRefresh(
    barcode: barcode,
    localDatabase: localDatabase,
  );
  return result.questions ?? <RobotoffQuestion>[];
}