flutter_pravatar 0.5.0 icon indicating copy to clipboard operation
flutter_pravatar: ^0.5.0 copied to clipboard

Display placeholder profile pictures for mocked users. Based on pravatar.cc.

flutter_pravatar #

Display placeholder profile pictures from pravatar.cc/ for mocked users.

Usage #

Random #

Display a a random placholder avatar, different each time it is loaded.

@override
Widget build(BuildContext context) {
  return Pravatar.random(),
}

Unique identifier #

Display the placholder avatar associated to the given uniqueId.

The avatar is guaranteed to be always the same as soon as the provided uniqueId is the same.

@override
Widget build(BuildContext context) {
  return Pravatar.uniqueId('user10@email.com'),
}

Image identifier #

Display the placholder avatar from its imageId.

All identifiers are available on the website.

@override
Widget build(BuildContext context) {
  return Pravatar.imageId(27),
}

Image provider #

If you want to use the image provider manually, you can use [PravatarImage].

@override
Widget build(BuildContext context) {
    final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
    return Image(
        image: PravatarImage(
            size: devicePixelRatio * 100,
            uniqueId: 'user10@email.com',
        ),
    );
}
1
likes
120
pub points
13%
popularity

Publisher

verified publisher iconaloisdeniel.com

Display placeholder profile pictures for mocked users. Based on pravatar.cc.

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_pravatar