Riddles API - Dart/Flutter Client
Riddles returns a random riddle with its answer from a hand-curated collection of about 500 classic riddles, puns and word puzzles. Filter by category (animals, food, words, nature, music, places and more) and difficulty, or fetch a riddle by its id. Paid plans add the pun explanation behind the answer, the book each riddle comes from, and up to 20 riddles per call.
This is the Dart/Flutter client for the Riddles API.
Installation
Add this to your pubspec.yaml:
dependencies:
apiverve_riddles: ^1.2.6
Then run:
dart pub get
# or for Flutter
flutter pub get
Usage
import 'package:apiverve_riddles/apiverve_riddles.dart';
void main() async {
final client = RiddlesClient('YOUR_API_KEY');
try {
final response = await client.execute({
'category': 'animals',
'difficulty': 'easy',
'id': 'rdl-0042',
'count': 5
});
print('Status: ${response.status}');
print('Data: ${response.data}');
} catch (e) {
print('Error: $e');
}
}
Response
{
"status": "ok",
"error": null,
"data": {
"matching": 1,
"count": 1,
"riddles": [
{
"id": "rdl-0002",
"riddle": "What flowers can be found between the nose and chin?",
"answer": "Tulips.",
"explanation": "two lips",
"category": "body",
"difficulty": "easy",
"source": {
"title": "Conundrums, Riddles and Puzzles",
"author": "Dean Rivers",
"year": 1903
}
}
]
}
}
API Reference
- API Home: Riddles API
- Documentation: docs.apiverve.com/ref/riddles
Authentication
All requests require an API key. Get yours at apiverve.com.
License
MIT License - see LICENSE for details.
Built with Dart for APIVerve
Libraries
- apiverve_riddles
- Riddles API client for Dart/Flutter