dart_lib

Creator: coderz1093

Last updated:

0 purchases

dart_lib Image
dart_lib Images

Languages

Categories

Add to Cart

Description:

dart lib

Library based on faker.js
Install #
dart pub add dart_lib
copied to clipboard
dependencies:
dart_lib: ^1.0.0

copied to clipboard
Usage #
import 'package:dart_lib/dart_lib.dart';

class User {
String firstName, lastName, country, city, email;
User(this.firstName, this.lastName, this.country, this.city, this.email);
}

Future<void> main(List<String> args) async {
var fake = await Faker().fake(); // English By default

var firstName = Faker.shuffle(fake['name']['first_name']);
var lastName = Faker.shuffle(fake['name']['last_name']);
var country = Faker.shuffle(fake['address']['country']);
var city = Faker.shuffle(fake['address']['city_name']);
var smtp = Faker.shuffle(fake['internet']['free_email']);
var email = '$firstName.$lastName@$smtp';

var user = User(firstName, lastName, country, city, email);
print(user.firstName);
print(user.lastName);
print(user.country);
print(user.city);
print(user.email);

// By Locale
var heFaker = await Faker.Locale('he').fake(); // Hebrew

firstName = Faker.shuffle(heFaker['name']['first_name']);
lastName = Faker.shuffle(fake['name']['last_name']);
country = Faker.shuffle(fake['address']['country']);
city = Faker.shuffle(fake['address']['city_name']);
smtp = Faker.shuffle(fake['internet']['free_email']);
email = '$firstName.$lastName@$smtp';

user = User(firstName, lastName, country, city, email);
print(user.firstName);
print(user.lastName);
print(user.country);
print(user.city);
print(user.email);

var frFaker = await Faker.Locale('fr').fake(); //France

firstName = Faker.shuffle(frFaker['name']['first_name']);
lastName = Faker.shuffle(frFaker['name']['last_name']);
country = Faker.shuffle(frFaker['address']['country']);
city = Faker.shuffle(frFaker['address']['city_name']);
smtp = Faker.shuffle(frFaker['internet']['free_email']);
email = '$firstName.$lastName@$smtp';

user = User(firstName, lastName, country, city, email);
print(user.firstName);
print(user.lastName);
print(user.country);
print(user.city);
print(user.email);

// ....
}

copied to clipboard


## Full Documentaion

Faker.js [issue tracker][tracker].

[tracker]: https://github.com/marak/Faker.js/
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.