isCurrency function

bool isCurrency(
  1. String input, {
  2. dynamic symbol = '\$',
  3. dynamic require_symbol = false,
  4. dynamic allow_space_after_symbol = false,
  5. dynamic symbol_after_digits = false,
  6. dynamic allow_negatives = true,
  7. dynamic parens_for_negatives = false,
  8. dynamic negative_sign_before_digits = false,
  9. dynamic negative_sign_after_digits = false,
  10. dynamic allow_negative_sign_placeholder = false,
  11. dynamic thousands_separator = ',',
  12. dynamic decimal_separator = '.',
  13. dynamic allow_decimal = true,
  14. dynamic require_decimal = false,
  15. dynamic digits_after_decimal = const [2],
  16. dynamic allow_space_after_digits = false,
})

Check if string input is a currency optional params symbol = "$" require_symbol = false allow_space_after_symbol = false symbol_after_digits = false allow_negatives = true parens_for_negatives = false negative_sign_before_digits = false negative_sign_after_digits = fasle allow_negative_sign_placeholder = false thousands_separator = ',' decimal_separator = '.' allow_decimal = true require_decimal = false digits_after_decimal = const 2 allow_space_after_digits = false

Implementation

bool isCurrency(
  String input, {
  symbol = '\$',
  require_symbol = false,
  allow_space_after_symbol = false,
  symbol_after_digits = false,
  allow_negatives = true,
  parens_for_negatives = false,
  negative_sign_before_digits = false,
  negative_sign_after_digits = false,
  allow_negative_sign_placeholder = false,
  thousands_separator = ',',
  decimal_separator = '.',
  allow_decimal = true,
  require_decimal = false,
  digits_after_decimal = const [2],
  allow_space_after_digits = false,
}) {
  return _regexBuild(
    symbol: symbol,
    require_symbol: require_symbol,
    allow_space_after_symbol: allow_space_after_symbol,
    symbol_after_digits: symbol_after_digits,
    allow_negatives: allow_negatives,
    parens_for_negatives: parens_for_negatives,
    negative_sign_before_digits: negative_sign_before_digits,
    negative_sign_after_digits: negative_sign_after_digits,
    allow_negative_sign_placeholder: allow_negative_sign_placeholder,
    thousands_separator: thousands_separator,
    decimal_separator: decimal_separator,
    allow_decimal: allow_decimal,
    require_decimal: require_decimal,
    digits_after_decimal: digits_after_decimal,
    allow_space_after_digits: allow_space_after_digits,
  ).hasMatch(input);
}