xwidget_el
library
Extensions
ColorExt
on Color
ListBrackets
on List
ListExt
on List <E >
MapBrackets
on Map <String , dynamic >
A simple utility for retrieving data using dot/bracket notation. As long as
your data follows a simple convention you can use a simplified dot/bracket
notation to locate any piece of data in your hierarchy. Searches return null
if no data is found or if the path string is invalid.
MapExt
on Map <K , V >
Functions
abs (dynamic value )
→ num ?
Returns the absolute value of value.
ceil (dynamic value )
→ int ?
Returns the smallest integer greater than or equal to value.
contains (dynamic value , dynamic searchValue )
→ bool
Returns true if value contains searchValue.
containsKey (Map ? map , dynamic searchKey )
→ bool
Returns true if map contains the given searchKey.
containsValue (Map ? map , dynamic searchValue )
→ bool
Returns true if map contains the given searchValue.
deepEquals (dynamic obj1 , dynamic obj2 )
→ bool
Performs a deep equality comparison between obj1 and obj2.
deepHashCode (dynamic value )
→ int
Computes a deep hash code for value.
diffDateTime (DateTime left , DateTime right )
→ Duration
Returns the absolute difference between two DateTime s.
endsWith (String ? value , String searchValue )
→ bool
Returns true if value ends with searchValue.
first (dynamic value )
→ dynamic
Returns the first element of value.
floor (dynamic value )
→ int ?
Returns the largest integer less than or equal to value.
formatDateTime (String format , dynamic value )
→ String ?
Formats a DateTime value using the given format pattern.
formatDuration (Duration ? value , [String precision = "s" , DurationFormat ? format = defaultDurationFormat ])
→ String ?
Formats a Duration into a human‑readable string.
isBlank (String ? value )
→ bool
Returns true if value is null or consists only of whitespace.
isEmpty (dynamic value )
→ bool
Returns true if value is empty or null.
isFalse (dynamic value )
→ bool
Returns true if value evaluates to boolean false.
isFalseOrNull (dynamic value )
→ bool
Returns true if value is null or evaluates to boolean false.
isNotBlank (String ? value )
→ bool
Returns true if value is not blank.
isNotEmpty (dynamic value )
→ bool
Returns true if value is not empty.
isNotNull (dynamic value )
→ bool
Returns true if value is not null.
isNull (dynamic value )
→ bool
Returns true if value is null.
isTrue (dynamic value )
→ bool
Returns true if value evaluates to boolean true.
isTrueOrNull (dynamic value )
→ bool
Returns true if value is null or evaluates to boolean true.
last (dynamic value )
→ dynamic
Returns the last element of value.
length (dynamic value )
→ int
Returns the length of value.
mapsEqual (Map a , Map b )
→ bool
Compares two maps a and b for shallow equality.
matches (String ? value , String regExp )
→ bool
Returns true if value fully matches the given regExp.
nonNullType (Type type )
→ String
Returns the non‑nullable form of a Type .
now ()
→ DateTime
Returns the current UTC DateTime .
nowUtc ()
→ DateTime
Returns this DateTime value in the UTC time zone.
parseBool (String ? value )
→ bool ?
Parses a string into a bool .
parseColor (String ? value )
→ Color ?
Parses a hex string into a Color .
parseDateTime (String ? value )
→ DateTime ?
Parses a string into a DateTime .
parseDouble (String ? value )
→ double ?
Parses a string into a double .
parseDuration (String ? value )
→ Duration ?
Parses a string into a Duration .
parseEnum <T extends Enum > (List <T > values , String ? value )
→ T?
Parses a string into an enum constant of type T.
parseInt (String ? value , {int ? radix })
→ int ?
Parses a string into an int .
parseListOfDoubles (String ? value )
→ List <double > ?
Parses a comma‑separated string into a list of doubles.
parseListOfInts (String ? value )
→ List <int > ?
Parses a comma‑separated string into a list of ints.
parseListOfStrings (String ? value )
→ List <String > ?
Parses a comma‑separated string into a list of strings.
randomDouble ()
→ double
Generates a non-negative random floating point value uniformly distributed
in the range from 0.0, inclusive, to 1.0, exclusive.
randomInt (int max )
→ int
Generates a non-negative random integer uniformly distributed in the range
from 0, inclusive, to max, exclusive.
replaceAll (String ? value , String regExp , String replacement )
→ String ?
Replaces all substrings in value that match regExp with replacement.
replaceFirst (String ? value , String regExp , String replacement , [int startIndex = 0 ])
→ String ?
Replaces the first substring in value that matches regExp with replacement.
round (dynamic value )
→ int ?
Rounds value to the nearest integer.
startsWith (String ? value , String searchFor )
→ bool
Returns true if value starts with searchFor.
substring (String ? value , int start , [int end = -1 ])
→ String ?
Returns a substring of value from start to end.
toBool (dynamic value , [Set ? trueValues , Set ? falseValues ])
→ bool ?
Converts a dynamic value to a bool .
toColor (dynamic value )
→ Color ?
Converts a dynamic value to a Color .
toDateTime (dynamic value )
→ DateTime ?
Converts a dynamic value to a DateTime .
toDays (dynamic value )
→ int ?
Converts a dynamic value to an integer representing days.
toDouble (dynamic value )
→ double ?
Converts a dynamic value to an integer representing days.
toDuration (dynamic value , [String ? intUnit ])
→ Duration ?
Converts a dynamic value to a Duration .
toEnum <T extends Enum > (dynamic value , List <T > values )
→ T?
Converts a dynamic value to an enum constant of type T.
toHours (dynamic value )
→ int ?
Converts a dynamic value to an integer representing hours.
toInt (dynamic value )
→ int ?
Converts a dynamic value to an int .
toMillis (dynamic value )
→ int ?
Converts a dynamic value to an integer representing milliseconds.
toMinutes (dynamic value )
→ int ?
Converts a dynamic value to an integer representing minutes.
toSeconds (dynamic value )
→ int ?
Converts a dynamic value to an integer representing seconds.
toString (dynamic value )
→ String ?
Converts a dynamic value to a String .
tryParseBool (String ? value )
→ bool ?
Attempts to parse value into a bool.
Returns null instead of throwing if parsing fails.
tryParseDateTime (String ? value )
→ DateTime ?
Attempts to parse value into a DateTime.
Returns null instead of throwing if parsing fails.
tryParseDouble (String ? value )
→ double ?
Attempts to parse value into a double.
Returns null instead of throwing if parsing fails.
tryParseDuration (String ? value )
→ Duration ?
Attempts to parse value into a Duration.
Returns null instead of throwing if parsing fails.
tryParseEnum <T extends Enum > (List <T > values , String ? value )
→ T?
Attempts to parse value into an enum constant of type T.
Returns null instead of throwing if parsing fails.
tryParseInt (String ? value )
→ int ?
Attempts to parse value into an int.
Returns null instead of throwing if parsing fails.
tryToBool (dynamic value )
→ bool ?
Attempts to convert value to a bool.
Returns null instead of throwing if conversion fails.
tryToColor (dynamic value )
→ Color ?
Attempts to convert value to a Color.
Returns null instead of throwing if conversion fails.
tryToDateTime (dynamic value )
→ DateTime ?
Attempts to convert value to a DateTime.
Returns null instead of throwing if conversion fails.
tryToDays (dynamic value )
→ int ?
Attempts to convert value to days.
Returns null instead of throwing if conversion fails.
tryToDouble (dynamic value )
→ double ?
Attempts to convert value to a double.
Returns null instead of throwing if conversion fails.
tryToDuration (dynamic value , [String ? unit ])
→ Duration ?
Attempts to convert value to a Duration.
Returns null instead of throwing if conversion fails.
tryToEnum <T extends Enum > (List <T > values , dynamic value )
→ T?
Attempts to convert value to an enum constant of type T.
Returns null instead of throwing if conversion fails.
tryToHours (dynamic value )
→ int ?
Attempts to convert value to hours.
Returns null instead of throwing if conversion fails.
tryToInt (dynamic value )
→ int ?
Attempts to convert value to an int.
Returns null instead of throwing if conversion fails.
tryToMillis (dynamic value )
→ int ?
Attempts to convert value to milliseconds.
Returns null instead of throwing if conversion fails.
tryToMinutes (dynamic value )
→ int ?
Attempts to convert value to minutes.
Returns null instead of throwing if conversion fails.
tryToSeconds (dynamic value )
→ int ?
Attempts to convert value to seconds.
Returns null instead of throwing if conversion fails.
typeOf <T > ()
→ Type
Returns the Type of generic parameter T.