fetchFAQs method

Future fetchFAQs()

Implementation

Future fetchFAQs() async {
  try {
    var response = await http.get(getCausesApiPath("v1/faqs"));
    if (response.statusCode != 200) {
      print("Error whilst fetching FAQs");
      return false;
    }
    _faqs = json
        .decode(response.body)['data']
        .map((e) => FAQ.fromJson(e))
        .toList()
        .cast<FAQ>();
  } catch (e) {
    print("Failed to fetch faqs");
    print(e);
    return e.toString();
  }
}