dart_extend 0.0.3 dart_extend: ^0.0.3 copied to clipboard
A dart pakage with many diffrent method to fasten up your coding.
Features #
use the following dart method directly in your code and speed up your app development #
Validators
.isNull //return bool check if the given value is null or not
.isemail(); // return bool
.isNum; //return bool check if the given string is numeric type or not
Formatters
.removeduplicates(); // remove duplicates from your list
.ordinal();; // convert number into ordered form e.g 1st 2nd 55th 22th
.isNum; //return bool check if the given string is numeric type or not
converter
From Epoch
1665102617.epochToDate(); // return DateTime like 2022-10-07 05:41:03.162
1665102617.epochToTime();// 5:30 AM
final date2 = DateTime(2011, 1, 15).weekOftheYearFromDate(); // 2nd week
98.minToDuration(); // 1.6 hr
Getting started #
Validators #
final email = 'mashoodhussain100@gmail.com'.isemail(); // true
final email = "mashood100".isemail(); // false
"1223ee2".isNum; //false
bool isDouble = "122".isNum; // true
check is string value is number or not
"1223ee2".isNum; //false
"122".isNum; // true
Formatters #
final test1 = 44.ordinal(); // 44th
final test2 = 1.ordinal();// 1st
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 ]
Conversations #
From Epoch
final test1 = 1665102617.epochToDate(); // return DateTime like 2022-10-07 05:41:03.162
final time = 1665102617.epochToTime();// 5:30 AM
From DateTime
final date1 = DateTime.now().weekOftheYearFromDate(); // return current week number of the year eg: 12
final date2 = DateTime(2011, 1, 15).weekOftheYearFromDate(); // 2
final week = 112398.minToDuration(); // weeks
final week = 98.minToDuration(); // 1.6 hr
Time Ago Stamps #
From Epoch
String myTimeago = DateTime.now().timeAgoSinceDateTime(dateInNumbers: true); // just now
From DateTime
String timeagoInString = 1665192814.timeAgoSinceEpochDate(dateInNumbers: false); // return 12 days ago
Additional information #
For more info or contribution visit https://github.com/mashood100/dart_extend