fetchQuestionnaire method Null safety
- String params
Implementation
static Future<Questionnaire> fetchQuestionnaire(String params) async {
String aber = "https://opentdb.com/api.php?$params";
final response = await http.get(Uri.parse(aber)); //&type=boolean
if (response.statusCode == 200) {
return Questionnaire.fromJson(jsonDecode(response.body));
} else {
throw Exception('Failed to load questions');
}
}