Dice Roller API - Dart/Flutter Client
Dice Roller is a dice API that simulates RPG dice rolls using standard notation like 3d6 or 2d20 with optional modifiers. It outputs the individual die outcomes, die count, and the sum of all rolls.
This is the Dart/Flutter client for the Dice Roller API.
Installation
Add this to your pubspec.yaml:
dependencies:
apiverve_diceroller: ^1.2.3
Then run:
dart pub get
# or for Flutter
flutter pub get
Usage
import 'package:apiverve_diceroller/apiverve_diceroller.dart';
void main() async {
final client = DicerollerClient('YOUR_API_KEY');
try {
final response = await client.execute({
'dice': '1d6',
'modifier': 5
});
print('Status: ${response.status}');
print('Data: ${response.data}');
} catch (e) {
print('Error: $e');
}
}
Response
{
"status": "ok",
"error": null,
"data": {
"dice_notation": "3d6",
"num_dice": 3,
"num_sides": 6,
"modifier": 5,
"rolls": [
6,
4,
4
],
"total": 14,
"total_with_modifier": 19,
"min_roll": 4,
"max_roll": 6,
"average_roll": 4.67,
"theoretical_min": 3,
"theoretical_max": 18,
"theoretical_average": 10.5,
"expression": "3d6+5"
}
}
API Reference
- API Home: Dice Roller API
- Documentation: docs.apiverve.com/ref/diceroller
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_diceroller
- Dice Roller API client for Dart/Flutter