DiceBear Core (Dart)

Dart implementation of the DiceBear avatar library. Generates deterministic SVG avatars from style definitions and a seed string.

DiceBear is available for multiple languages. All implementations share the same PRNG and rendering pipeline, producing identical SVG output for the same seed, style, and options, regardless of the language used.

Playground | Documentation

Installation

dart pub add dicebear_core
dart pub add dicebear_styles

dicebear_core is the engine; the avatar style definitions ship separately in the pure-data dicebear_styles package.

Requires Dart 3.4 or newer.

Usage

import 'package:dicebear_core/dicebear_core.dart';
import 'package:dicebear_styles/adventurer.dart';

void main() {
  // Each style ships as a raw JSON string; Style.parse decodes and validates it.
  final style = Style.parse(adventurer);

  final avatar = Avatar(style, {
    'seed': 'John Doe',
    'size': 128,
  });

  print(avatar.svg); // SVG string
  print(avatar.toDataUri()); // data:image/svg+xml;charset=utf-8,...
}

Using the Style type

final style = Style.parse(adventurer);

// Create multiple avatars from the same style
final avatar1 = Avatar(style, {'seed': 'Alice'});
final avatar2 = Avatar(style, {'seed': 'Bob'});

If you already hold a decoded definition (a Map<String, Object?>, for example one you built yourself or decoded with jsonDecode), pass it to the default Style(...) constructor instead of Style.parse.

Sponsors

Advertisement: Many thanks to our sponsors who provide us with free or discounted products.

Libraries

dicebear_core
Unique avatars from dozens of styles — deterministic, customizable, vector-based.