0 purchases
dart extend
Wanna Contribute in hacktoberfest 2022 🙌 #
Follow Simple Rules #
1) Fork this repository first
2) Star this repository⭐
3) Create a new issue detailing what you want to add and create a branch from the issue
4) Add your details in the CONTRIBUTING.md file⭐
**5) Add a folder that define the class or method you want to upload and add your code to the folder and create a PULL REQUEST.
Some Code Guidelines #
Variable name should be meaningful.
Use comments in your code.
Your Code must be pretty formated.
After a valid pull request your code will be carefully reviewed and if it matches the rule then it will be accepted otherwise you need to generate a new file #
About 📕 #
Dart Extend provides a variety of dart methods and classes so you can write better and clean app functionality
Publisher: Mashood Hussain #
Features 🔌 #
Dart Extend provides a variety of dart methods and classes so you can write better and clean app functionality
⚠️ Validators #
👷 Formatters #
♻️ Converter #
⏳ Time Stamps #
🎰 Generator #
Getting started 🚀 #
Validators #
final email = '[email protected]'.isemail(); // true
final email = "mashood100".isemail(); // false
"1223ee2".isNum; //false
bool isDouble = "122".isNum; // true
copied to clipboard
check string value is number or not
"1223ee2".isNum; //false
"122".isNum; // true
copied to clipboard
Formatters #
// the method will convert any num type value in decimal pattern eg :22000 ===> 22,000
1232123.233.toDecimalPattern() // 1,232,123
// by default the valueAfterpoint is set to 0
32123.123.toDecimalPattern(valueAfterpoint: 1) // 32,123.1
copied to clipboard
final test1 = 44.ordinal(); // 44th
final test2 = 1.ordinal();// 1st
copied to clipboard
Remove Duplicates from List
List myArray = ['x', 'w', 'x', 'y', 'o', 'x', 'y', 'y', 'r', 'a'];
List unique = myArray.removeduplicates(); //[ x, w, y ,o, r, a ]
copied to clipboard
Conversations #
// convert bytes into readable Memory Units
11432.convertBytesToMemoryUnit() // 11kb
1142132.convertBytesToMemoryUnit() // 1.1 MB
copied to clipboard
From Epoch
final test1 = 1665102617.epochToDate(); // return DateTime like 2022-10-07 05:41:03.162
final time = 1665102617.epochToTime();// 5:30 AM
copied to clipboard
From DateTime
final date1 = DateTime.now().weekOftheYearFromDate(); // return current week number of the year eg: 12
final date2 = DateTime(2011, 1, 15).weekOftheYearFromDate(); // 2
copied to clipboard
final week = 112398.minToDuration(); // weeks
final week = 98.minToDuration(); // 1.6 hr
copied to clipboard
Time Ago Stamps #
From Epoch
String myTimeago = DateTime.now().timeAgoSinceDateTime(dateInNumbers: true); // just now
copied to clipboard
From DateTime
String timeagoInString = 1665192814.timeAgoSinceEpochDate(dateInNumbers: false); // return 12 days ago
copied to clipboard
Generate Random Numbers and IDs
var generate = Generator();
// genrate Random number between 2 values
print(generate.randomNumber(2, 9)); //5
// genrate alphanumeric key of length 44 character
// Ideal when you want to produce a large number of IDs.
print(generate
.createCryptoRandomString()); //KPVz7OIagov_hsn6Hs65XsvH-x43j0XyMNf6HrWMrcQ=
// another id genrator genrate alphanumeric key of length 44 character
print(generate.uniqueId().length);
copied to clipboard
Generate user names
var generate = Generator();
print(generate.randomUserName());
// barley_harryy_1
// set addspcae parameter false so it will generate username without spaces( _ )
// by default its true
print(generate.randomUserName(addSpace: false));
// barleyharryy1
print(generate.makeUserName('mashood'));
// mashood_82
print(generate.makeUserName('Mashood Hussain'));
// mashood_Hussain_23
print(generate.makeUserName('Mashood Hussain'));
// mashoodHussain23
// set with number false to make usernames with number
print(generate.makeUserName('John Doe', withNumber: false));
// mashood_Hussain
// you can also set prefix and sufffix so it will apperes on every username that you generates
print(generate.makeUserName('Mashood Hussain',
withNumber: false, prefix: 'developer', suffix: 'fultter'));
// developer_mashood_hussain_flutter
print(generate.makeUserName('[email protected]',
date: DateTime.parse('2001-06-20')));
// mashood_01
print(
generate.usernameFromName(
firstName: 'mashood',
lastName: 'hussain',
adjectives: ['ready', 'happy']),
);
// doe_john_10_ready
print( generate.usernameFromName(firstName: 'Mashood', lastName: 'huss'), );
// mashood_huss_78
//set isadjectives true to get a username with adjective word
print( generate.listOfUserName('Mashood Hussain', length: 4, isadjectives: true) );
// [
// 4_mashood_awsome,
// 20_hussain_great,
// 7_mashood_fast,
// hussain_mashood_99
// ]
// by default isadjectives is false
print(
generate.listOfUserName('Mashood Hussain', length: 4),
);
// [
// 4_mashood,
// 20_hussain,
// 7_mashood,
// hussain_mashood_99
// ]
copied to clipboard
Additional information ℹ️ #
For more info or contribution please visit
Dart Extend Repo
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.