flutter_dtx 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

flutter_dtx #

Dart utils Extension functions Flutter package for Basic dart extension functions.

Usage #

  • To use this package

String Extenstions

  1. isEmail() check whether the string is valid email or not
  2. isPhoneNumber() check whether the string is valid phone number. (can able to validate for Specific Country code)
  3. isAlpha() return true if there is only alphabets in string
  4. isAlphaNumeric() return true if there is only alphabets and numeric (no special chars $%^&*)
  5. isNumeric() return true if there is only numeric values in string eg 12345 or 1.22
  6. isInt() return true if string is valid integer eg 123
  7. isFloat() return true if string is valid floating value eg 1.2
  8. isHexColor() return true if string is valid hexadecimal color code
  9. toInt() parse string to Int
  10. toDouble() parse string to Double
  11. toHexColor() parse string hexadecimal color to color object
  12. capitalize() Capitalize the string eg flutter to Flutter
  13. deCapitalize() Decapitalize the string eg Flutter to flutter
  14. log() For Logging calls print()
  15. jsonDecode() Parse string to Json map<String,Dynamic>
  16. toDate(String format) parse String to DateTime
  17. formatDateStringToUTC(String inputPattern,String outputPattern) format StringDate UTC StringDate
  18. changeDateStringFormat(String inputPattern,String outputPattern) changes the date format
  19. formatDateStringToLocal(String inputPattern,String outputPattern) parse StringDate toLocal date
  20. toCharsList() convert String to list of Chars
  21. chunk() divide String to List
  22. replaceChars(int start,int end,String delimiter) replace chars from start to end with delimeter eg 12345****10
  23. insert(int steps, String valueToInsert) insert string in after specify chars[steps]
  24. equalsIgnorecase(String compareTo) compare string in case Insensitive manner

Int Extensions

  1. getDateFromMillis() Parse int to DateTime (int should be millis)
  2. timeAgoString() returns ago time based on Millis

Object Extensions

  1. getEnumName() returns the name of Enum Object (Separates enum class name with Object)

Context Extensions

  1. navigateTo(Widget destinationWidget, {bool isPushReplace = false) redirect to other screen which passed as widget
  2. hideKeyboard() hide a keyboard if showing on screen
  3. getDeviceSize() return a screen size
  4. popScreen() pops the screen with context

[1.0.1] - Initial release #

[1.0.2] - Enum Object extension #

[1.0.3] - Phone number validation with country #


import 'package:flutter_dtx/flutter_dtx.dart';

class Example {
  void demoMethod() {
    //checks email (valid Email)

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_dtx: ^1.0.3

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_dtx/flutter_dtx.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 26, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Format lib/flutter_dtx.dart.

Run flutter format to format lib/flutter_dtx.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
intl ^0.16.0 0.16.1
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
path 1.6.4
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8