click on this link https://drive.google.com/file/d/14KA7jyAjBrTp85pwVvJzsKgwDtRjL7-N/view?usp=sharing to download the package it is a single file that you copy and paste in our project, it has No dependency, No YAML required, lightweight, works on all versions of dart
To start using the package your must first create a string representation of your model fields inside your class definition just like this, make it static. we are using the model User for our example
Just copy paste it from your model definition to avoid spelling mistakes
class User{
// Normal class fields and methods goes here
static String AnkhMockerInit = """
int idUser;
String avatar;
String coverImage;
String fullName;
String startDate;
String descriptionlen45;
bool isOnline;
""";
}
it has no dependency , it is lightweight (single file) and it works on all versions of dart.
- Generate Mock data from your model fields definition
- Generate random text from specified length just like lorem ipsum engine
- Generate random image links (avatars,images)
- Generate random date in string format
- Generate random integer in string format
After that you can generate a single object like this
dynamic userJSON = await AnkhMocker.generateData(
fieldSchema: User.AnkhMockerInit);
AnkhMocker have two Additional parameters
1 . delaiInSec
Which determine the amount of time (in seconds) to wait before the data is generated. defaults to 1
dynamic userJSON =
await AnkhMocker.generateData(fieldSchema: User.AnkhMockerInit,delayInSec: 5);
2 . count
This parameter helps you to generate a collection of objects (An array of JSON objects), its value represent the number of objects you want to generate
dynamic usersArray =
await AnkhMocker.generateData(fieldSchema: User.AnkhMockerInit,delayInSec: 5,count: 15);
Just make sure the name of the field contains the string avatar
String userAvatar;
Just make sure the name of the field contains the string image
String coverImage;
Just make sure the name of the field contains the string date
String createdDate;
Just make sure the name of the field contains the string len45 , the number 45 here represent the length that you want your text to have, you can replace it with any length
String userDescriptionlen45;
You also have the ability to generate random data without the need to define a model
- Generate a random text , in the example 45 represent the length of the text , you can define any length
String myText = AnkhMocker.generateText(45);
- Generate random Date
// single String myDate = AnkhMocker.generateDate(); // output : 18 jan 2022 // Multiple List<String> myAvatarURLs = AnkhMocker.generateDateList(10);
- Generate random avatarURL
// single String myAvatarURL = AnkhMocker.generateAvatarURL(); // Multiple List<String> myAvatarURLs = AnkhMocker.generateAvatarURLList(10);
- Generate random imageURL
// Single String imageURL = AnkhMocker.generateRandomImageURL(); //Mulitple List<String> imageURLs = AnkhMocker.generateImageURLList(10);
this is my profile https://twitter.com/neferou_/status/1679088623054929920?s=46&t=LBm7BbTCqcHgoPTZM5SYgQ
If you found the package useful, you can support either in Crypto 😏 (BTC or ETH), here are my wallets adresses
Bitcoin
bc1q8n7z8uyz84p9gv00ytvc2w3k3jhlyz6j85drwh
Ethereum
0x8D0E3Bb7EB460E518A5D1203eb71b86097f04bda
Tether (BEP20)
0x8D0E3Bb7EB460E518A5D1203eb71b86097f04bda
Tether (ERC20)
0x8D0E3Bb7EB460E518A5D1203eb71b86097f04bda
BNB
0x8D0E3Bb7EB460E518A5D1203eb71b86097f04bda
Orange Money - Cameroon - name : Tesse brunel
697830071
MTN mobile money - Cameroon - name : Hamadjoda
678724995
Tap Tap Send - Cameroon
678724995