Stefan de Vogelaere

Add extension methods to GetUtils

@@ -8,6 +8,7 @@ export 'src/snackbar/snack_route.dart'; @@ -8,6 +8,7 @@ export 'src/snackbar/snack_route.dart';
8 export 'src/state/get_state.dart'; 8 export 'src/state/get_state.dart';
9 export 'src/state/get_view.dart'; 9 export 'src/state/get_view.dart';
10 export 'src/regex/get_utils.dart'; 10 export 'src/regex/get_utils.dart';
  11 +export 'src/regex/get_utils_extensions.dart';
11 export 'src/queue/get_queue.dart'; 12 export 'src/queue/get_queue.dart';
12 export 'src/state/mixin_state.dart'; 13 export 'src/state/mixin_state.dart';
13 export 'src/rx/rx_interface.dart'; 14 export 'src/rx/rx_interface.dart';
  1 +import 'get_utils.dart';
  2 +
  3 +extension GetStringUtils on String {
  4 + bool get isNum => GetUtils.isNum(this);
  5 + bool get isNumericOnly => GetUtils.isNumericOnly(this);
  6 + bool get isAlphabetOnly => GetUtils.isAlphabetOnly(this);
  7 + bool get isBool => GetUtils.isBool(this);
  8 + bool get isVectorFileName => GetUtils.isVector(this);
  9 + bool get isImageFileName => GetUtils.isImage(this);
  10 + bool get isAudioFileName => GetUtils.isAudio(this);
  11 + bool get isVideoFileName => GetUtils.isVideo(this);
  12 + bool get isTxtFileName => GetUtils.isTxt(this);
  13 + bool get isDocumentFileName => GetUtils.isDocument(this);
  14 + bool get isExcelFileName => GetUtils.isExcel(this);
  15 + bool get isPPTFileName => GetUtils.isPPT(this);
  16 + bool get isAPKFileName => GetUtils.isAPK(this);
  17 + bool get isPDFFileName => GetUtils.isPDF(this);
  18 + bool get isHTMLFileName => GetUtils.isHTML(this);
  19 + bool get isURL => GetUtils.isURL(this);
  20 + bool get isEmail => GetUtils.isEmail(this);
  21 + bool get isPhoneNumber => GetUtils.isPhoneNumber(this);
  22 + bool get isDateTime => GetUtils.isDateTime(this);
  23 + bool get isMD5 => GetUtils.isMD5(this);
  24 + bool get isSHA1 => GetUtils.isSHA1(this);
  25 + bool get isSHA256 => GetUtils.isSHA256(this);
  26 + bool get isISBN => GetUtils.isISBN(this);
  27 + bool get isBinary => GetUtils.isBinary(this);
  28 + bool get isIPv4 => GetUtils.isIPv4(this);
  29 + bool get isIPv6 => GetUtils.isIPv6(this);
  30 + bool get isHexadecimal => GetUtils.isHexadecimal(this);
  31 + bool get isPalindrom => GetUtils.isPalindrom(this);
  32 + bool get isPassport => GetUtils.isPassport(this);
  33 + bool get isCurrency => GetUtils.isCurrency(this);
  34 + bool isCaseInsensitiveContains(String b) =>
  35 + GetUtils.isCaseInsensitiveContains(this, b);
  36 + bool isCaseInsensitiveContainsAny(String b) =>
  37 + GetUtils.isCaseInsensitiveContainsAny(this, b);
  38 + String capitalize(String s, {bool firstOnly = false}) =>
  39 + GetUtils.capitalize(this, firstOnly: firstOnly);
  40 + String capitalizeFirst(String s) => GetUtils.capitalizeFirst(this);
  41 + String removeAllWhitespace(String s) => GetUtils.removeAllWhitespace(this);
  42 + String camelCase(String s) => GetUtils.camelCase(this);
  43 + String numericOnly(String s, {bool firstWordOnly = false}) =>
  44 + GetUtils.numericOnly(this, firstWordOnly: firstWordOnly);
  45 +}
  46 +
  47 +extension GetNumUtils on num {
  48 + bool isLowerThan(num b) => GetUtils.isLowerThan(this, b);
  49 + bool isGreaterThan(num b) => GetUtils.isGreaterThan(this, b);
  50 + bool isEqual(num b) => GetUtils.isEqual(this, b);
  51 +}
  52 +
  53 +extension GetDynamicUtils on dynamic {
  54 + bool get isNull => GetUtils.isNull(this);
  55 + bool get isNullOrBlank => GetUtils.isNullOrBlank(this);
  56 + bool get isOneAKind => GetUtils.isOneAKind(this);
  57 + bool isLengthLowerThan(int maxLength) =>
  58 + GetUtils.isLengthLowerThan(this, maxLength);
  59 + bool isLengthGreaterThan(int maxLength) =>
  60 + GetUtils.isLengthGreaterThan(this, maxLength);
  61 + bool isLengthGreaterOrEqual(int maxLength) =>
  62 + GetUtils.isLengthGreaterOrEqual(this, maxLength);
  63 + bool isLengthLowerOrEqual(int maxLength) =>
  64 + GetUtils.isLengthLowerOrEqual(this, maxLength);
  65 + bool isLengthEqualTo(int maxLength) =>
  66 + GetUtils.isLengthEqualTo(this, maxLength);
  67 + bool isLengthBetween(int minLength, int maxLength) =>
  68 + GetUtils.isLengthBetween(this, minLength, maxLength);
  69 +}