A fully-typed Dart/Flutter wrapper for the DiceBear API (v9.x) that generates unique avatar profile pictures with extensive customization options.
DiceBear is an avatar library for designers and developers. Generate random, deterministic avatar profile pictures from seeds, supporting 30+ unique art styles with fine-grained style-specific customization.
✨ Full Type Safety — Every style option is a dedicated Dart class with compile-time validation
🎯 30+ Avatar Styles — Support for all DiceBear styles including Adventurer, Avataaars, PixelArt, and more
🔧 Style-Specific Customization — Each style has its own set of customization options (eyes, mouth, accessories, etc.)
📦 Flexible Output — Get SVG URLs, rendered Flutter widgets, or raw SVG bytes
🎲 Deterministic & Random — Generate consistent avatars from a seed or random ones each time
Installation
Add to your pubspec.yaml:
dependencies:dice_bear:^1.0.0
Then run flutter pub get.
Quick Start
Basic Usage
import'package:dice_bear/dice_bear.dart';
// Create a simple avatar requestfinal request = DiceBearRequest(
style: DiceBearStyle.adventurer,
coreOptions: DiceBearCoreOptions(
seed: 'john_doe', // Deterministic: same seed = same avatar
),
);
// Render as Flutter widgetWidget widget = request.toImage(width: 200, height: 200);
// Get the SVG URLUri svgUrl = request.uri;
// Get raw SVG bytesUint8List? svgBytes = await request.fetchBytes();
Random Avatar
// Generate a new random avatar each timefinal request = DiceBearRequest(
style: DiceBearStyle.random,
coreOptions: DiceBearCoreOptions(
seed: DateTime.now().millisecondsSinceEpoch.toString(),
),
);
Advanced Usage
Style-Specific Customization
Each DiceBear style has its own options class for fine-grained control: