Buckets:
| import 'dart:convert'; | |
| import 'package:http/http.dart' as http; | |
| import 'package:sportquiz/models/question.dart'; | |
| import 'package:sportquiz/models/category.dart'; | |
| const String baseUrl = "https://opentdb.com/api.php"; | |
| Future<List<Question>> getQuestions( | |
| Category category, int? total, String? difficulty) async { | |
| String url = "$baseUrl?amount=$total&category=${category.id}"; | |
| if (difficulty != null) { | |
| url = "$url&difficulty=$difficulty"; | |
| } | |
| http.Response res = await http.get(Uri.parse(url)); | |
| List<Map<String, dynamic>> questions = | |
| List<Map<String, dynamic>>.from(json.decode(res.body)["results"]); | |
| return Question.fromData(questions); | |
| } | |
Xet Storage Details
- Size:
- 665 Bytes
- Xet hash:
- 0f8da1e780f66e74d37b68cb289993505ad25019c632cf3eeb7626611ee32f3b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.