StringExtension extension

String Extension to add useful utility methods

on

Properties

isApk → bool

Available on String, provided by the StringExtension extension

Checks if the string is a valid APK file URL.
no setter
isAudio → bool

Available on String, provided by the StringExtension extension

Checks if the string is a valid audio URL.
no setter
isDoc → bool

Available on String, provided by the StringExtension extension

Checks if the string is a valid document URL.
no setter
isEmptyOrNull → bool

Available on String, provided by the StringExtension extension

Returns true if the string is either null or empty.
no setter
isExcel → bool

Available on String, provided by the StringExtension extension

Checks if the string is a valid Excel file URL.
no setter
isHtml → bool

Available on String, provided by the StringExtension extension

Checks if the string is a valid HTML string.
no setter
isImage → bool

Available on String, provided by the StringExtension extension

Checks if the string is a valid image URL.
no setter
isInt → bool

Available on String, provided by the StringExtension extension

Checks if the string is an integer.
no setter
isPdf → bool

Available on String, provided by the StringExtension extension

Checks if the string is a valid PDF file URL.
no setter
isPPT → bool

Available on String, provided by the StringExtension extension

Checks if the string is a valid PowerPoint file URL.
no setter
isTxt → bool

Available on String, provided by the StringExtension extension

Checks if the string is a valid text file URL.
no setter
isValidEmail → bool

Available on String, provided by the StringExtension extension

Validates if the string is a valid email address.
no setter
isVideo → bool

Available on String, provided by the StringExtension extension

Checks if the string is a valid video URL.
no setter
renderHtml → String

Available on String, provided by the StringExtension extension

Renders HTML encoded string to a plain text representation.
no setter
reverse → String

Available on String, provided by the StringExtension extension

Reverses the string.
no setter

Methods

calculateReadTime({int wordsPerMinute = 200}) → double

Available on String, provided by the StringExtension extension

Calculates the average reading time in seconds based on word count and words per minute.
copyToClipboard() → Future<void>

Available on String, provided by the StringExtension extension

Copies the string to clipboard.
countWords() → int

Available on String, provided by the StringExtension extension

Returns the number of words in the string.
formatNumberWithComma({String separator = ','}) → String

Available on String, provided by the StringExtension extension

Formats a number in the string with a comma separator (e.g., 1000 -> 1,000).
getColorFromHex() → Color

Available on String, provided by the StringExtension extension

getNumericOnly({bool aFirstWordOnly = false}) → String

Available on String, provided by the StringExtension extension

Returns only numeric characters from the string.
getYouTubeThumbnail({bool trimWhitespaces = true}) → String

Available on String, provided by the StringExtension extension

Returns YouTube thumbnail image URL for the given video ID.
isAlpha() → bool

Available on String, provided by the StringExtension extension

Checks if the string contains only alphabetic characters.
isDigit() → bool

Available on String, provided by the StringExtension extension

Returns true if the string is a digit.
isJson() → bool

Available on String, provided by the StringExtension extension

Checks if the string is a valid JSON.
prefixText({required String value}) → String

Available on String, provided by the StringExtension extension

Adds a prefix to the string.
removeAllWhiteSpace() → String

Available on String, provided by the StringExtension extension

Removes all whitespace characters from the string.
repeat(int n, {String separator = ''}) → String

Available on String, provided by the StringExtension extension

Repeats the string n times, optionally with a separator.
replaceNonAlphaNumericWithUnderscore() → String

Available on String, provided by the StringExtension extension

Replaces all non-alphanumeric characters with underscores.
setSearchParam() → List<String>

Available on String, provided by the StringExtension extension

Returns a list of search parameters to store for Firebase queries.
splitAfter(Pattern pattern) → String

Available on String, provided by the StringExtension extension

Splits the string after a pattern match.
splitBefore(Pattern pattern) → String

Available on String, provided by the StringExtension extension

Splits the string before a pattern match.
splitBetween(Pattern startPattern, Pattern endPattern) → String

Available on String, provided by the StringExtension extension

Splits the string between two patterns.
stripNonAlphaNumeric() → String

Available on String, provided by the StringExtension extension

Strips out the non-alphanumeric characters from the string.
suffixText({required String value}) → String

Available on String, provided by the StringExtension extension

Adds a suffix to the string.
toBool() → bool

Available on String, provided by the StringExtension extension

Converts the string to a boolean value based on 'true' or 'false' string.
toByteData() → Uint8List

Available on String, provided by the StringExtension extension

toDouble({double defaultValue = 0.0}) → double

Available on String, provided by the StringExtension extension

Converts the string to a double with a default value if conversion fails.
toInt({int defaultValue = 0}) → int

Available on String, provided by the StringExtension extension

Converts the string to an integer with a default value if conversion fails.
toList() → List<String>

Available on String, provided by the StringExtension extension

Converts the string into a list of characters.
toSlug({String delimiter = '_'}) → String

Available on String, provided by the StringExtension extension

Generates a URL-friendly slug from the string.
toYouTubeId({bool trimWhitespaces = true}) → String

Available on String, provided by the StringExtension extension

Extracts the YouTube video ID from a URL.
validate({String value = ''}) → String

Available on String, provided by the StringExtension extension

Returns a default value if the string is null or empty.
validateEmailEnhanced() → bool

Available on String, provided by the StringExtension extension

Validates if the string is a valid email address with enhanced checks.
validatePhone() → bool

Available on String, provided by the StringExtension extension

Validates if the string is a valid phone number.
validateURL() → bool

Available on String, provided by the StringExtension extension

Validates if the string is a valid URL.