flutter_dtx 1.0.2 flutter_dtx: ^1.0.2 copied to clipboard
Flutter package for Basic dart extension functions, can make use development speed fast
flutter_dtx #
Dart utils Extension functions Flutter package for Basic dart extension functions.
Usage #
- To use this package
dev_dependencies:
flutter_dtx:
String Extenstions
- isEmail() check whether the string is valid email or not
- isPhoneNumber() check whether the string is valid phone number. (can able to validate for Specific Country code)
- isAlpha() return true if there is only alphabets in string
- isAlphaNumeric() return true if there is only alphabets and numeric (no special chars $%^&*)
- isNumeric() return true if there is only numeric values in string eg 12345 or 1.22
- isInt() return true if string is valid integer eg 123
- isFloat() return true if string is valid floating value eg 1.2
- isHexColor() return true if string is valid hexadecimal color code
- toInt() parse string to Int
- toDouble() parse string to Double
- toHexColor() parse string hexadecimal color to color object
- capitalize() Capitalize the string eg flutter to Flutter
- deCapitalize() Decapitalize the string eg Flutter to flutter
- log() For Logging calls print()
- jsonDecode() Parse string to Json map<String,Dynamic>
- toDate(String format) parse String to DateTime
- formatDateStringToUTC(String inputPattern,String outputPattern) format StringDate UTC StringDate
- changeDateStringFormat(String inputPattern,String outputPattern) changes the date format
- formatDateStringToLocal(String inputPattern,String outputPattern) parse StringDate toLocal date
- toCharsList() convert String to list of Chars
- chunk() divide String to List
- replaceChars(int start,int end,String delimiter) replace chars from start to end with delimeter eg 12345****10
- insert(int steps, String valueToInsert) insert string in after specify chars[steps]
- equalsIgnorecase(String compareTo) compare string in case Insensitive manner
Int Extensions
- getDateFromMillis() Parse int to DateTime (int should be millis)
- timeAgoString() returns ago time based on Millis
Object Extensions
- getEnumName() returns the name of Enum Object (Separates enum class name with Object)
Context Extensions
- navigateTo(Widget destinationWidget, {bool isPushReplace = false) redirect to other screen which passed as widget
- hideKeyboard() hide a keyboard if showing on screen
- getDeviceSize() return a screen size
- popScreen() pops the screen with context