mock_data library

Generate random data using Dart.

List of random data to generate:

  • colors with various color spaces
  • date between different moments in time
  • integers in between range of numbers
  • IPs ~ IPv4 and IPv6
  • name; male or female first name
  • strings of different length and characters
  • url with different parts; routes, GET query parameters and fragments
  • uuid ~ version 4, timestamp-first and null

Inspired by: https://www.npmjs.com/package/mock-data

Functions

mockColor([String returnModel = 'rgb']) String
Generate random color from a given model. [...]
mockDate([DateTime firstMoment, DateTime secondMoment]) DateTime
Generate random DateTime object in between two moments in time. [...]
mockInteger([int min = 1, int max = 10]) int
Generate random integer in range from min to max, inclusive. [...]
mockIPv4([String format = '*.*.*.*']) String
Generate random IPv4 address. [...]
mockIPv6([String format = '*:*:*:*:*:*:*:*']) String
Generate random IPv6 address. [...]
mockName([String gender = 'any']) String
Generate random first name. [...]
mockRange<E>(Function mockFunction, int numberOfMocks, {int lengthOfMockedString: 16, String include: '!', int min: 1, int max: 10, String format: '*.*.*.*', String gender: 'any', String returnModel: 'rgb', String scheme: '*', bool withPath: false, dynamic withQuery: false, dynamic withFragment: false, DateTime firstMoment, DateTime secondMoment, String uuidType: 'ver4'}) List<E>
Generic function to generate list of mocks. [...]
mockString([int lengthOfMockedString = 16, String include = '!']) String
Generate random string. [...]
mockUrl([String scheme = '*', bool withPath = false, dynamic withQuery = false, dynamic withFragment = false]) String
Generate random URL from a given parameters. [...]
mockUUID([String uuidType = 'ver4']) String
Generate version 4 based UUID. [...]