Flutter: Ultimate Data Generator

Written by Emile Pavie-Olivier

December 30, 2019

in packages


Introduction:

Ultimate Data Generator (UDG) is the most complete offline data generator for prototyping using Flutter. It gives you access to a lot of data that doesn’t just look like place holder text but actual real looking data!
By using this package, you will have access to diverse elements from basic data to a little bit more advanced one such as name, surnames, email, comments(classified by category), food names and ingredients used for them and so much more.

Before We Start

Before reading the documentation, here are some relevant link

Have a look at the demo Apk

This is a short gif of the demo application

Categories

UDG classes are divided into diverse categories to facilitate you to generate only the data you need for your project. These categories are as follow:

  • The general-purpose category: It contains the Gen class which contains methods that could not fit into a specific category eg: GeneratePercntage().
  • The industry category: It contains classes designed to generate industry-related data such as job occupation for example.
  • The places category: It contains classes designed to generate data about places such as hospital names, college names, city names, etc…
  • The social media category: Here it is all about social media, you will get access to comments subdivided into different categories, profile biographies, etc…
  • The food category: Here it is all about food, you will get access to diver culinary diversities for vegan, vegetarian and non-vegetarian.
  • The Human category: This contains all basic human data generators such as name, surname, full name, Job title, etc…

Classes And Methods

To make it easy for you, click on one of the elements of the list below to go directly to the desired content

Note: here is how to use any of the classes.

-> Import the package in your project

-> Call the class name and one of its methods depending on your use case
You can have:

A) The Gen Class

The Gen Class consists about 11 methods for uncategorized (or yet to be) data that can be used for various purposes we have:

  • generatePercentage() → int:
    This will generate a random number (integer) percentage, the number will be in the range [0..100] inclusive
  • generatePercentageString() → String:
    This will generate a random number (integer) percentage, the number will be in the range [0..100] inclusive but will return a String along with the % notation
  • generateNumberinRange({@required int a, int b}) → Int:
    This will generate a random number in the range [a…b], b inclusive and return an integer
  • generate Job0ccupation() → String:
    Also available on the IndustryGen class, this will generate a job or an occupation
  • generatelD({int length, String customStart}) → String:
    This will generate a random ID, if the length is not specified(null), the generated ID will be of length 8. If a string is passed to the customStart parameter, it will be added at the beginning of the generated ID
  • generateAPrice({PriceRange priceRange = PriceRange.medium)) → String:
    This will generate the price of an item, It takes an optional enum ”PriceRange” that is set to medium by default. More about this enumeration can be found here
    Note: Currently Price Range only supports the American Dollar so the string will be returned as follow
  • generateDuration((bool generateOnlyMinute = false)) → String :
    This will generate a String in the format __h__m; in case you only need minutes, set the optional and only parameter to true
  • generateMorningTime() → String:
    This will generate a String in the format __:__am
  • generateAfternoonTime() → String:
    This will generate a String in the format __:__pm
  • generateRating() → int:
    This will generate a rating in the range [0…5], 5 inclusive
  • generatePassword() → String:
    This will generate a password String

B) The FoodGen class

The food category is divided into 3 types of food courses (starter, main meal, snacks) and 3 types of food category (vegan, vegetarian, non-vegetarian).
This class will provide you with food names, descriptions, and ingredients used for each food.

Note: In order to use this class properly, you need to follow a method calling order rule.
-> A food description cannot be generated without a food name being generated first
-> A food ingredient list cannot be generated without a food name being generated first
This means that [ at the exception of the generateRestaurantName() and image generation methods ] you should first generate a food name in the category that you want before calling any other method

Here are the methods and descriptions:

There are independent methods

  • generateRestaurantName() → String:
    This will generate a restaurant name
  • generateVeganImage() → String:
    This will the image of a vegan plate of food
  • generateVegetarianImage() → String:
    This will the image of a vegetarian plate of food
  • generateNonVegImage() → String:
    This will the image of a non-vegetarian plate of food

These methods are for the food generation

  • generateVeganStarterFoodName() → String:
    this will generate the name of a vegan starter food
  • currentVeganStarterFoodDescription() → String:
    this will generate the description of the “most recent” generated vegan starter food name
  • currentVeganStarterFoodingredient() → String:
    this will generate the ingredients used on the “most recent” vegan starter food name
  • generateVeganMainMealFoodName() → String:
    this will generate the name of a vegan main meal course
  • currentVeganMainMealFoodDescription() → String:
    this will generate the description of the “most recent” generated vegan main meal course
  • currentVeganMainMealFoodIngredient() → String:
    this will generate the ingredients used on the “most recent” generated vegan main meal course
  • generateVeganSnacksFoodName() → String:
    this will generate the name of a vegan snack
  • currentVeganSnacksFoodDescription() → String:
    this will generate the description of the “most recent” generated vegan snack
  • currentVeganSnacksFoodIngredient() → String:
    this will generate the ingredients used on the “most recent” generated vegan snack

The Vegetarian and NonVegetarian categories obey by the same naming rule and the same description
-> Vegetarian: replace ”Vegan” in the above list of methods by ”Vegetarian”, the description will remain the same

-> Non-vegetarian: replace ”Vegan” in the above list of methods by ”NonVegetarian”, the description will remain the same

C) The HumanGen class

The HumanGen class will generate basic data and pictures related to humans.
Please note that methods designed to image generation will only generate a path to an image locally stored within the package thus a string is returned

These are for image generation

  • generateFemaleImage() → String:
    This will generate the path to a local adult [OR] teenager female profile picture
    No kids picture will be generated
  • generateMaleImage() → String:
    This will generate the path to a local adult [OR] teenager male profile picture
    No kids picture will be generated
  • generateAdultFemaleImage() → String:
    This will generate the path to an Adult female image
  • generateAdultMaleImage() → String:
    This will generate the path to an Adult male image
  • generateKidMaleImage() → String:
    This will generate the path to a kid male image
  • generateKidFemaleImage() → String:
    This will generate the path to a kid female image
  • generateTeenMaleImage() → String:
    This will generate the path to a teen male image
  • generateTeenFemaleImage() → String:
    This will generate the path to a teen female image

These are for Data generation

  • generateAFullName() → String:
    This will generate a full name (name + surname) of a boy or a girl
  • generateASurname() → String:
    This will generate a surname
    (Surnames are common for boys and girls )
  • generateAFirstName() → String:
    This will generate the first name of a boy or a girl
  • generateAGirlFirstName() → String:
    This will generate the first name of a girl
  • generateABoyFirstName() → String:
    This will generate the first name of a boy
  • generateAGirlFullName() → String:
    This will generate the full name of a girl
  • generateABoyFullName() → String:
    This will generate the full name of a boy
  • generateAUsername() → String:
    This will generate a username
  • generateEmailFromMostRecentName() → String:
    This will generate an email for the most Recent name generated,
    This is useful in case you are creating a fake user profile and you want your email ID to be similar to your name/surname/full name.
  • generateRandomEmail() → String:
    This will just generate a random email ID that will be suitable for any gender
  • generateLocalAddress() → String:
    This will generate a local address
  • generateKidAge({bool useExtension = true}) → String:
    This will generate a kid age in the range [5..9], 9 inclusive,
    If ”useExtension‘ is set to true then the resulting string will contain the word ”years”, otherwise only an integer String will be returned
  • generateTeenAge({bool useExtension = true}) → String:
    This will generate a teenager age in the range [10..19], 19 inclusive,
    If ”useExtension” is set to true then the resulting string will contain the word ”years”, otherwise only an integer String will be returned
  • generateMidAdultAge({bool useExtension = true}) → String:
    This will generate a mid-adult age in the range [20..65], 65 inclusive,
    If ”useExtension” is set to true then the resulting string will contain the word ”years”, otherwise only an integer String will be returned
  • generateAdultAge({bool useExtension = true}) → String:
    This will generate an adult age in the range [66..100], 100 inclusive,
    If ”useExtension” is set to true then the resulting string will contain the word ”years”, otherwise only an integer String will be returned
  • generateACommonSpokenLanguage() → String:
    This will generate a commonly spoken language among the 38 most spoken languages
  • generateASpokenLanguage() → String:
    This will generate a language name that you probably do not know about
  • generatePhoneNumber({int length, int startingwith, bool shallFormat, int countryCode}) → String:
    Use this to generate a phone number
    -> If the length is null it will be assumed to be 10;
    -> If startingWith is null then it will start with a random number;
    -> If the country code is null then a phone number without country code will be returned
    Note that the number will be formated to (xxx) xxx xxxx if the length is 10 and will not if the length is greater or less
  • generateJobOccupation() → String:
    This will generate a job occupation
    Note that this method is also available in the IndustryGen class and PlacesGen class

D) The IndustryGen class

Here are the methods

  • generateCarBrandName() → String:
    This will generate the name of a car brand
  • generateTechCompanyName() → String:
    This will generate the name of a tech company
  • generateMusicGenre() → String:
    This will generate a music genre
  • generateEmailProviderName() → String:
    This will generate the name of an email provider
  • generateJobOccupation() → String:
    This will generate a job occupation
    Note that this method is also available in the HumanGen class and PlacesGen class
  • generateLocalAddress() → String:
    This will generate a local address
    Note that this method is also available in the HumanGen class and PlacesGen class

E) The SocialMediaGen class

This class contain useful methods especially if your application needs lots of reviews 🙂

  • generateRandomComment() → String:
    This will generate a comment or small review on any topic
  • generateAPlatformName() → String:
    This will generate the name of a social media platform among the popular ones
  • generateABio() → String:
    This will generate a profile biography
  • generateMusicComment() → String:
    This will generate a comment about a music
  • generateCarComment() → String:
    This will generate a comment about a car
  • generateHotelReview() → String:
    This will generate a review of a hotel or resort
  • generateRestaurantReview() → String:
    This will generate a review of a restaurant food quality as well as staff quality
  • generateTechComment() → String:
    This will generate a comment about tech, very vague but it will be tech related
  • generateFashionComment() → String:
    This will generate a comment about the fashion topic, like a cloth someone is wearing

F) The PlacesGen class

This class will generate places data such as countries name and cities, or even colleges name

These methods return path to images

  • generateHomeImage() → String:
    This will generate the path to a home image
  • generateHotelImage() → String:
    This will generate the path to a hotel image

Other methods

  • generateLocalAddress() → String:
    This will generate a local address
    Note that this method is also available in the HumanGen class and the IndustryGen class
  • generateAnHoteIName() → String:
    This will generate the name of a hotel
  • generateAnHospitallName() → String:
    This will generate the name of a hospital
  • generateAMallName()→ String:
    This will generate the name of a mall
  • generateSchoolName() → String:
    This will generate the name of a school
  • generateHighSchoolName() → String:
    This will generate the name of a high school
  • generateCollegeAndUniversitiesName() → String:
    This will generate the name of a college/university
  • generateCountryName() → String:
    This will generate the name of a country
  • generateCityOrTownName() → String:
    This will generate the name of a city or ta town
  • generateCanadianCityOrTownName() → String:
    This will generate the name of a city or ta town located in Canada
  • generateUSACityOrTownName() → String:
    This will generate the name of a city or ta town located in the USA
  • generateUSACityAndState() → String:
    This will generate the name of a city AND state located in the USA
  • generateCanadianCityAndState() → String:
    This will generate the name of a city AND state located in Canada

Conclusion

That is it! hope The documentation was clear enough
For example please refer to the example folder of the package.
I will probably write a tutorial on how to use it
If you want to keep updated with me, then follow me on Instagram forget
Thank you

Related Articles

Stay Up to Date With My Latest News & Updates

Join My Newsletter

 

Follow Me