Flutter tutorials and courses by Andrea Bizzotto

How to quickly generate some fake data when building Flutter UIs

Are you building some UI in Flutter and need to show some temporary data?

The faker package makes this super easy!

You can use it to generate addresses, names, food, dates, sports... you name it!

Here's an example:

import 'package:faker/faker.dart'; void main() { final faker = Faker(); faker.internet.email(); // francisco_lebsack@buckridge.com faker.internet.ipv6Address(); // 2450:a5bf:7855:8ce9:3693:58db:50bf:a105 faker.internet.userName(); // fiona-ward faker.person.name(); // Fiona Ward faker.person.prefix(); // Mrs. faker.person.suffix(); // Sr. faker.lorem.sentence(); // Nec nam aliquam sem et }

Note: new random data will be generated every time a new Faker() object is created, including when you hot-reload and hot-restart.

Happy coding!

Want more?

Fast-track your Flutter learning with over 40 hours of in-depth content.