Create AvataaarGenerator widget and pass it the avatar:
AvataaarGenerator
(
avataaar: avataaar,
onTranslateKey: (String key) {
returnTranslate.get(key);
}
onUpdateAvataaar:() {setState((){});},
);
// By default package will use SvgPicture to render the image. AvataaarPicture could be used to create a custom// [builder] constructor and create widget for given image url:AvataaarPicture.builder(
builder: (context, avataaar) {
// ...
},
)
Persisting avatars
Use Avataaar.toJson() and Avataaar.fromJson(String) methods to serialize/deserialize avatars.
Getting image bytes
Use the funtion getPngFromSvg from the class Avataaar to get the png File.