generate method

String generate()

Implementation

String generate() {
  if (isModel) {
    return 'mock$type()';
  } else if (declaration.isEnum) {
    return _enumFaker(declaration.getEnum(className));
  } else if (declaration.fakerDeclaration != null) {
    return _interpretFaker(declaration.fakerDeclaration!);
  } else if (type == 'int') {
    return 'faker.randomGenerator.integer(100)';
  } else if (type == 'String') {
    return _guessString(declaration.jsonValue as String?);
  } else if (type == 'bool') {
    return 'faker.randomGenerator.boolean()';
  } else if (type == 'double' || type == 'num') {
    return 'faker.randomGenerator.decimal()';
  } else if (type == 'DateTime') {
    return 'faker.date.dateTime(minYear: 1900, maxYear: 2025)';
  } else if (type.startsWith('Map')) {
    return '{}';
  } else {
    return 'null';
  }
}