This file is auto generated. Do not edit this file manually. Last Updated: Sat, Mar 23, 2024 - 10:13 AM
Extension | Type | Description |
---|---|---|
< |
METHOD |
Returns true if other object is less than this . |
<= |
METHOD |
Returns true if other object is less than or equal to this . |
> |
METHOD |
Returns true if other object is greater than this . |
>= |
METHOD |
Returns true if other object is greater than or equal to this . |
coerceAtLeast |
METHOD |
Ensures that this value is not less than the specified minimum value. returns this value if it's greater than or equal to the minimum value or the minimum value otherwise. |
coerceAtMost |
METHOD |
Ensures that this value is not greater than the specified maximum value. Returns this value if it's less than or equal to the maximum value or the maximum value otherwise. |
coerceIn |
METHOD |
Ensures that this value lies in the specified range min <--> max . Return this value if it's in the range, or min value if this value is less than min value, or max value if this value is greater than max value. |
Extension | Type | Description |
---|---|---|
secondOrNull |
GETTER |
Returns the second element in the iterable or returns null if iterable is empty or has only 1 element. |
thirdOrNull |
GETTER |
Returns the third element in the iterable or returns null if iterable is empty or has less than 3 elements. |
lastIndex |
GETTER |
Returns the index of the last element in the collection. |
hasOnlyOneElement |
GETTER |
Returns true if the collection only has 1 element. |
records |
GETTER |
Returns an iterable containing the items with their respective indices in form of records. One of the use-cases includes iterating over the collection with access to the index of each item in a for loop. e.g. for (final (index, item) in list.records) { print('$index: $item'); } |
filterTo |
METHOD |
Appends all elements matching the given predicate to the given destination . |
filter |
METHOD |
alias for Iterable.where |
filterIndexed |
METHOD |
alias for whereIndexed which returns a new lazy Iterable. |
flatMap |
METHOD |
alias for Iterable.map |
drop |
METHOD |
alias for Iterable.skip |
takeLast |
METHOD |
alias for Iterable.skip |
dropWhile |
METHOD |
alias for Iterable.skipWhile |
dropLast |
METHOD |
alias for Iterable.skip |
all |
METHOD |
alias for Iterable.every |
associate |
METHOD |
Returns a Map containing key-value pairs provided by transform function applied to elements of the given List. |
associateTo |
METHOD |
Populates and returns the destination map with key-value pairs provided by transform function applied to each element of the given iterable. |
associateBy |
METHOD |
Returns a Map containing the elements from the given List indexed by the key returned from keySelector function applied to each element. |
associateByTo |
METHOD |
Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function applied to each element of the given iterable and value is the element itself. |
associateWith |
METHOD |
Returns a Map where keys are elements from the given iterable and values are produced by the valueSelector function applied to each element. |
associateWithTo |
METHOD |
Populates and returns the destination map with key-value pairs for each element of the given iterable, where key is the element itself and value is provided by the valueSelector function applied to that key. |
groupBy |
METHOD |
Groups elements of the original iterable by the key returned by the given keySelector function applied to each element and returns a map where each group key is associated with a list of corresponding elements. |
groupByTo |
METHOD |
Groups elements of the original iterable by the key returned by the given keySelector function applied to each element and puts to the destination map each group key associated with a list of corresponding elements. |
distinct |
METHOD |
Returns an iterable containing only distinct elements from the given iterable. |
distinctBy |
METHOD |
Returns an iterable containing only elements from the given iterable having distinct keys returned by the given selector function. |
distinctByTo |
METHOD |
Populates and returns the destination list with containing only elements from the given iterable having distinct keys returned by the given selector function. |
intersect |
METHOD |
Returns a set containing all elements that are contained by both this iterable and the other iterable. |
subtract |
METHOD |
Returns a set containing all elements that are contained by this iterable and not contained by the other iterable. |
union |
METHOD |
Returns an iterable containing all distinct elements from both iterables. |
count |
METHOD |
Returns the number of elements matching the given predicate . |
foldRight |
METHOD |
Accumulates value starting with initialValue value and applying operation from right to left to each element and current accumulator value. |
foldRightIndexed |
METHOD |
Accumulates value starting with initialValue value and applying operation from right to left to each element with its index in the original list and current accumulator value. |
randomOrNull |
METHOD |
Returns a random element from this . Returns null if no elements are present. |
random |
METHOD |
Returns a random element from this . Throws StateError if there are no elements in the collection. |
onEach |
METHOD |
Performs the given action on each element and returns the iterable itself afterwards. |
maxByOrNull |
METHOD |
Returns the first element yielding the largest value of the given function or null if there are no elements. |
maxBy |
METHOD |
Returns the first element yielding the largest value of the given function. Throws StateError if there are no elements in the collection. |
maxByLastOrNull |
METHOD |
Returns the last element yielding the largest value of the given function or null if there are no elements. |
maxByLast |
METHOD |
Returns the last element yielding the largest value of the given function. Throws StateError if there are no elements in the collection. |
minByOrNull |
METHOD |
Returns the first element yielding the smallest value of the given function or null if there are no elements. |
minBy |
METHOD |
Returns the first element yielding the smallest value of the given function. Throws StateError if there are no elements in the collection. |
minByLastOrNull |
METHOD |
Returns the last element yielding the smallest value of the given function or null if there are no elements. |
minByLast |
METHOD |
Returns the last element yielding the smallest value of the given function. Throws StateError if there are no elements in the collection. |
sumBy |
METHOD |
Returns the sum of all values produced by selector function applied to each element in the collection. |
averageBy |
METHOD |
Returns the average of all values produced by selector function applied to each element in the collection. |
except |
METHOD |
Alias for subtract . |
containsAll |
METHOD |
Returns true if the collection contains all the elements present in other collection. |
containsNone |
METHOD |
Returns true if the collection doesn't contain any of the elements present in other collection. |
findBy |
METHOD |
Finds an element where the result of selector matches the query . Throws StateError if no element is found. |
findByOrNull |
METHOD |
Finds an element where the result of selector matches the query . Returns null if no element is found. |
findAllBy |
METHOD |
Finds all elements where the result of selector matches the query . Returns empty collection if no element is found. |
Extension | Type | Description |
---|---|---|
isNullOrEmpty |
GETTER |
Returns true if this is either null or empty collection |
isNotNullOrEmpty |
GETTER |
Returns true if this is neither null nor empty collection |
Extension | Type | Description |
---|---|---|
next |
METHOD |
Advances the current index and returns current element |
Extension | Type | Description |
---|---|---|
<< |
METHOD |
adds element into the list and returns the list |
replaceFirstWhere |
METHOD |
Replaces an item in the list with replacement where predicate returns true. Returns true if an item is replaced, false otherwise. |
replaceLastWhere |
METHOD |
Replaces an item in the list with replacement where predicate returns true. Returns true if an item is replaced, false otherwise. |
Extension | Type | Description |
---|---|---|
records |
GETTER |
Similar to Map.entries but returns an iterable of records instead of MapEntry . One of the use-cases includes iterating over the collection with access to the key of each item in a for loop. e.g. for (final (key, value) in map.records) { print('$key: $value'); } |
+ |
METHOD |
Allows to add a record entry to this . |
<< |
METHOD |
Allows to add MapEntry to this . |
toJson |
METHOD |
Converts this map into a JSON string. |
except |
METHOD |
Returns a new Map with the same keys and values as this except keys present keys . |
only |
METHOD |
Returns a new Map with the same keys and values but only contains the keys present in keys . |
where |
METHOD |
Returns a new Map with the same keys and values as this where the key-value pair satisfies the test function. Similar to Iterable.where . |
whereNot |
METHOD |
Returns a new Map with the same keys and values as this where the key-value pair doesn't satisfy the test function. |
removeKeys |
METHOD |
Removes all the keys present in keys from this map. If this is an instance of UnmodifiableMapBase , it will return a new map with the same keys and values except the keys present in keys . |
Extension | Type | Description |
---|---|---|
dateOnly |
GETTER |
Returns an instance of DateTime without time related values. This is intended to remove hour, minute, second and millisecond information from DateTime instance which leaves only date information. Example: final date = DateTime().now(); // 26-07-2020 16:54:23 date.dateOnly // 26-07-2020 This is helpful in cases where comparison of only dates is required. |
isToday |
GETTER |
Returns true if this is same as the date of today. This doesn't account for time. |
isYesterday |
GETTER |
Returns true if this occurs a day before today This doesn't account for time. |
isTomorrow |
GETTER |
Returns true if this occurs a day after today This doesn't account for time. |
isPast |
GETTER |
Returns true if this occurs in past This doesn't account for time. |
isFuture |
GETTER |
Returns true if this occurs in future This doesn't account for time. |
isInPreviousMonth |
GETTER |
Returns true if this occurs in previous month |
isInNextMonth |
GETTER |
Returns true if this occurs in previous month |
isInPreviousYear |
GETTER |
Returns true if this occurs in previous year |
isInNextYear |
GETTER |
Returns true if this occurs in previous year |
isMonday |
GETTER |
Returns true if this occurs on Monday In accordance with ISO 8601, a week starts with Monday, which has the value 1. |
isTuesday |
GETTER |
Returns true if this occurs on Tuesday In accordance with ISO 8601, a week starts with Monday, which has the value 1. |
isWednesday |
GETTER |
Returns true if this occurs on Wednesday In accordance with ISO 8601, a week starts with Monday, which has the value 1. |
isThursday |
GETTER |
Returns true if this occurs on Thursday In accordance with ISO 8601, a week starts with Monday, which has the value 1. |
isFriday |
GETTER |
Returns true if this occurs on Friday In accordance with ISO 8601, a week starts with Monday, which has the value 1. |
isSaturday |
GETTER |
Returns true if this occurs on Saturday In accordance with ISO 8601, a week starts with Monday, which has the value 1. |
isSunday |
GETTER |
Returns true if this occurs on Sunday In accordance with ISO 8601, a week starts with Monday, which has the value 1. |
isInJanuary |
GETTER |
Returns true if this falls in january |
isInFebruary |
GETTER |
Returns true if this falls in february |
isInMarch |
GETTER |
Returns true if this falls in march |
isInApril |
GETTER |
Returns true if this falls in april |
isInMay |
GETTER |
Returns true if this falls in may |
isInJune |
GETTER |
Returns true if this falls in june |
isInJuly |
GETTER |
Returns true if this falls in july |
isInAugust |
GETTER |
Returns true if this falls in august |
isInSeptember |
GETTER |
Returns true if this falls in september |
isInOctober |
GETTER |
Returns true if this falls in october |
isInNovember |
GETTER |
Returns true if this falls in november |
isInDecember |
GETTER |
Returns true if this falls in december |
isLeapYear |
GETTER |
Returns true if this is a leap year |
previousDay |
GETTER |
Returns DateTime with previous day |
nextDay |
GETTER |
Returns DateTime with next day |
previousYear |
GETTER |
Returns DateTime with previous year |
nextYear |
GETTER |
Returns DateTime with next year |
fromNow |
METHOD |
Returns Duration difference between this and current time |
isBeforeDate |
METHOD |
Returns true if the date of this occurs before the date of other . The comparison is independent of whether the time is in UTC or in the local time zone. |
isAfterDate |
METHOD |
Returns true if the date of this occurs after the date of other . The comparison is independent of whether the time is in UTC or in the local time zone. |
isSameDateAs |
METHOD |
Returns true if the date of this occurs on the same day as the date of other . The comparison is independent of whether the time is in UTC or in the local time zone. |
< |
METHOD |
Returns true if this occurs before other . The comparison is independent of whether the time is in UTC or in the local time zone. |
> |
METHOD |
Returns true if this occurs after other . The comparison is independent of whether the time is in UTC or in the local time zone. |
<= |
METHOD |
Returns true if this occurs before or at the same moment as other . The comparison is independent of whether the time is in UTC or in the local time zone. |
>= |
METHOD |
Returns true if this occurs after or at the same moment as other . The comparison is independent of whether the time is in UTC or in the local time zone. |
+ |
METHOD |
+ operator that Adds duration to this e.g. DateTime twoDaysAfter = DateTime.now() + 2.days; |
- |
METHOD |
- operator that subtracts duration from this . e.g. DateTime fiveDaysAgo = DateTime.now() - 5.days; |
isBetween |
METHOD |
Returns true if this falls between date1 and date2 irrespective of the order in the Calender. |
truncateMicros |
METHOD |
Removes any information that is equal to or smaller than milliseconds. Returned instance will have 0 milliseconds and microseconds. |
truncateMillis |
METHOD |
Removes any information that is equal to or smaller than milliseconds. Returned instance will have 0 milliseconds and microseconds. |
truncateSeconds |
METHOD |
Removes any information that is equal to or smaller than seconds. Returned instance will have 0 seconds, milliseconds and microseconds. |
truncateMinutes |
METHOD |
Removes any information that is equal to or smaller than minutes. Returned instance will have 0 minutes, seconds, milliseconds and microseconds. |
format |
METHOD |
Formats date using DateFormat from intl package. |
only |
METHOD |
Returns DateTime with only information that is passed to the method. In contrast to DateTime.copyWith method, this method does not copy unspecified fields from the original DateTime . |
Extension | Type | Description |
---|---|---|
ago |
GETTER |
Returns DateTime that is before this duration. |
after |
GETTER |
Returns DateTime that is before this duration. |
fromNow |
GETTER |
Alias for after |
inYears |
GETTER |
Returns the number of whole years spanned by this Duration. Please note that this does not account for leap year. |
isInYears |
GETTER |
Returns true if this duration equals to or more than a year. |
isInDays |
GETTER |
Returns true if this duration equals to or more than a day. |
isInHours |
GETTER |
Returns true if this duration equals to or more than an hour but is less than a day. |
isInMinutes |
GETTER |
Returns true if this duration equals to or more than a minute but is less than an hour. |
isInSeconds |
GETTER |
Returns true if this duration equals to or more than a second but is less than a minute. |
isInMillis |
GETTER |
Returns true if this duration equals to or more than a millisecond but is less than a second. |
absoluteMinutes |
GETTER |
Returns remaining minutes after deriving hours. |
absoluteHours |
GETTER |
Returns remaining minutes after deriving days. |
absoluteSeconds |
GETTER |
Returns remaining minutes after deriving minutes. |
Extension | Type | Description |
---|---|---|
apply |
METHOD |
Calls the specified function block with this value as its argument and returns this value. |
run |
METHOD |
Calls the specified function block with this value as its argument and returns this value. |
takeIf |
METHOD |
Returns this if it satisfies the given predicate or null, if it doesn't. |
takeUnless |
METHOD |
Returns this if it doesn't satisfy the given predicate or null, if it doesn't. |
tryCast |
METHOD |
A safe cast operation that returns null if the cast is not possible. Otherwise, returns the casted value. |
Extension | Type | Description |
---|---|---|
toggled |
GETTER |
Returns opposite of this |
toInt |
METHOD |
Returns 1 if this is true and 0 if otherwise. |
Extension | Type | Description |
---|---|---|
isWhole |
GETTER |
Returns to if this has .00000 fraction points |
roundToPrecision |
METHOD |
Rounds value precision number of fraction points. Example: 2.1234567890.roundToPrecision(0)=> 2 2.1234567890.roundToPrecision(1)=> 2.1 2.1234567890.roundToPrecision(2)=> 2.12 2.1234567890.roundToPrecision(3)=> 2.123 |
isCloseTo |
METHOD |
Returns true if this is close to other within precision . By default, precision is set to 1.0e-8 which is 0.00000001 which makes it suitable for most of the cases. |
Extension | Type | Description |
---|---|---|
isLeapYear |
GETTER |
Returns true if this represents a leap year |
weeks |
GETTER |
Returns Duration equal to this no. of weeks |
weeksAgo |
GETTER |
Returns DateTime with date that is this weeks ago |
weeksAfter |
GETTER |
Returns DateTime with date that is this weeks after |
days |
GETTER |
Returns Duration equal to this no. of days |
daysAgo |
GETTER |
Returns DateTime with date that is this days ago |
daysAfter |
GETTER |
Returns DateTime with date that is this days after |
hours |
GETTER |
Returns Duration equal to this no. of hours |
hoursAgo |
GETTER |
Returns DateTime with time that is this hours ago |
hoursAfter |
GETTER |
Returns DateTime with time that is this hours after |
minutes |
GETTER |
Returns Duration equal to this no. of minutes |
minutesAgo |
GETTER |
Returns DateTime with time that is this minutes ago |
minutesAfter |
GETTER |
Returns DateTime with time that is this minutes after |
seconds |
GETTER |
Returns Duration equal to this no. of seconds |
milliseconds |
GETTER |
Returns Duration equal to this no. of milliseconds |
microseconds |
GETTER |
Returns Duration equal to this no. of microseconds |
length |
GETTER |
Returns no. of digits e.g. 3.length // returns 1 21.length // returns 2 541.length // returns 3 |
digits |
GETTER |
Returns list of digits of this e.g 12345.digits // returns [1, 2, 3, 4, 5] e.g 8564.digits // returns [8, 5, 6, 4] |
asBool |
GETTER |
Returns true for non-zero values just like C language. e.g 1.asBool // returns true 0.asBool // returns false 452.asBool // returns true |
isDivisibleBy |
METHOD |
Returns true if this can be completely divisible by divider |
isDivisibleByAll |
METHOD |
Returns true if this can be completely divisible by all of the dividers . |
repeat |
METHOD |
runs func for this number of times. This is irrespective of the sign of this . the for loop will always run from 1 to absolute value of this . Returns List of type T where T is the return type of func |
twoDigits |
METHOD |
Returns int as string which has a zero appended as prefix if this is a single digit value. |
rangeTo |
METHOD |
Creates an IntRange starting from this to end inclusively with default step size of 1. Example: 5.rangeTo(10); // creates range 5-6-7-8-9-10 |
downTo |
METHOD |
Creates an IntRange starting from this to end inclusively with default step size of 1. Example: 5.downTo(1); // creates range 5-4-3-2-1 |
until |
METHOD |
Returns a range from this value up to but excluding the specified end value. |
Extension | Type | Description |
---|---|---|
negative |
GETTER |
converts positive numbers into negative ones. Use abs for conversion to positive numbers. |
inRadians |
GETTER |
Turns this number from degrees to radians. |
inDegrees |
GETTER |
Turns this number from radians to degrees. |
isBetween |
METHOD |
Returns true if this falls between value1 and value2 irrespective of the order of value1 and value2 . Includes boundaries if inclusive is true. |
roundToPrecision |
METHOD |
Rounds value precision number of fraction points. |
Extension | Type | Description |
---|---|---|
max |
METHOD |
Returns upperBound if this value is greater than or equal to upperBound , otherwise returns this value. If exclusive is true, then it will return upperBound if this value is greater than upperBound . |
min |
METHOD |
Returns lowerBound if this value is less than or equal to lowerBound , Otherwise returns this value. If exclusive is true, then it will return lowerBound if this value is less than lowerBound . |
clampAtLeast |
METHOD |
Returns this value if it is greater than or equal to lowerBound . Returns lowerBound otherwise. |
clampAtMost |
METHOD |
Returns this value if it is less than or equal to upperBound . Returns upperBound otherwise. |
Extension | Type | Description |
---|---|---|
orZero |
GETTER |
Returns this value or 0 if null. Useful for equations. |
orOne |
GETTER |
Returns this value or 1 if null. Useful for equations. |
or |
METHOD |
Returns this or value if null. Useful for equations. |
Extension | Type | Description |
---|---|---|
isNull |
GETTER |
Returns true if the object is null |
isNotNull |
GETTER |
Returns true if the object is not null |
Extension | Type | Description |
---|---|---|
isBlank |
GETTER |
Returns true if this only contains white-spaces. |
isNotBlank |
GETTER |
Returns true if this contains characters other than white-spaces. |
capitalized |
GETTER |
Converts the first character of this to upper case. Note that this does not work if the first character of this string is an Emoji character. |
isBinary |
GETTER |
Returns true if this is a binary string which only contains 1's and 0's |
isHexadecimal |
GETTER |
Returns true if this is a hex string which only contains 0-9 and A-F |
isOctal |
GETTER |
Returns true if this is a hex string which only contains 0-7 |
isDecimal |
GETTER |
Returns true if this is an int |
isDouble |
GETTER |
Returns true if this is a double |
isEmail |
GETTER |
Returns true if this happens to be an email This uses RFC822 email validation specs which is widely accepted. check this: https://regexr.com/2rhq7 Original Ref: https://www.ietf.org/rfc/rfc822.txt |
reversed |
GETTER |
Returns a reversed string of this |
words |
GETTER |
This would tokenize this into words by breaking it with space. |
toggledCase |
GETTER |
Toggles the case of the characters |
toIntOrNull |
METHOD |
Returns this as int or null Radix be between 2..36 |
toDoubleOrNull |
METHOD |
Returns this as double or null |
toBoolOrNull |
METHOD |
Returns true only if this equals to be true (insensitive of case) or if a non-zero integer. e.g 'true'.toBoolOrNull() // returns true 'TRUE'.toBoolOrNull() // returns true 'FALSE'.toBoolOrNull() // returns false 'something'.toBoolOrNull() // returns null '1'.toBoolOrNull() // returns true '0'.toBoolOrNull() // returns false |
wrap |
METHOD |
wraps this between prefix and suffix . Uses prefix as suffix if suffix is null. e.g. 'hello'.wrap("*"); // returns hello 'html'.wrap('<','>'); // returns |
unwrap |
METHOD |
unwraps this between prefix and suffix . Uses prefix as suffix if suffix is null. e.g. 'hello'.unwrap("*"); // returns hello ''.unwrap('<','>'); // returns html |
removePrefix |
METHOD |
removes prefix from this and returns remaining. e.g. 'hello-world'.removePrefix('hello'); // returns -world 'hello-world'.removePrefix('world'); // returns hello-world |
removeSuffix |
METHOD |
removes suffix from this and returns remaining. e.g. 'hello-world'.removeSuffix('world'); // returns hello- 'hello-world'.removeSuffix('hello'); // returns hello-world |
toDateTimeOrNull |
METHOD |
Tries to convert this into a DateTime . |
parseJson |
METHOD |
Converts this to a JSON map. |
parseJsonArray |
METHOD |
Converts this to a JSON map. |
count |
METHOD |
Returns count of given match in this string |
find |
METHOD |
alias for indexOf |
title |
METHOD |
Makes all the words capitalized in this string Note that this does not work properly if the first character of any word is an Emoji character. |
equalsIgnoreCase |
METHOD |
Compares two strings ignoring the case. |
splitMapJoinRegex |
METHOD |
An alternative to String.splitMapJoin which provides access to RegExpMatch instead of Match . Match does not provide access to named groups. RegExpMatch does. Reference: dart-lang/sdk#52721 |
splitMap |
METHOD |
An alternative to String.splitMapJoin which allows to return mapped values from onMatch and onNonMatch callbacks unlike the original String.splitMapJoin which only allows to return String values. This uses splitMapJoinRegex internally which provides access to RegExpMatch instead of Match providing access to named groups as well. |
Extension | Type | Description |
---|---|---|
isNullOrEmpty |
GETTER |
Returns true if this is either null or empty string. |
isNotNullOrEmpty |
GETTER |
Returns true if this is neither null nor empty string. |
isNullOrBlank |
GETTER |
Returns true if this is either null or blank string. |
isNotNullOrBlank |
GETTER |
Returns true if this is neither null nor blank string. |
hasContent |
GETTER |
Alias for isNotNullOrEmpty |
orEmpty |
GETTER |
Returns this if it is not null, otherwise returns empty string. |
Extension | Type | Description |
---|---|---|
isEmpty |
GETTER |
Returns a Future containing a bool indicating whether this file is empty or not. |
isEmptySync |
GETTER |
Returns true if this file is empty |
copyTo |
METHOD |
Copies content of this to other file. |
clear |
METHOD |
Asynchronously flushes all the data in this file leaving it to be empty. |
clearSync |
METHOD |
Synchronously flushes all the data in this file leaving it to be empty. |
onModified |
METHOD |
Calls block whenever the this file is modified. Returns StreamSubscription which allows to cancel the listener. |
onDeleted |
METHOD |
Calls block whenever the this file is deleted. Returns StreamSubscription which allows to cancel the listener. |
appendString |
METHOD |
Appends value string at the end of the file using provided encoding . |
appendStringSync |
METHOD |
Appends value string at the end of the file using provided encoding . |
appendStringLine |
METHOD |
Appends value string as a new line at the end of the file using provided encoding . |
appendBytes |
METHOD |
Appends value bytes at the end of the file. |
appendBytesSync |
METHOD |
Appends value bytes at the end of the file. |
appendFrom |
METHOD |
Appends content of file at the end of this file. |
appendFromSync |
METHOD |
Appends content of file at the end of this file. |
<< |
METHOD |
operator that allows to append value string at the end of the file using provided UTF-8 encoding. |
+ |
METHOD |
Allows to append content of file to this . |
Name | Description |
---|---|
post |
Runs given action no sooner than in the next event-loop iteration, after all micro-tasks have run. |
postDelayed |
Runs given action after a delay of millis , no sooner than in the next event-loop iteration, after all micro-tasks have run. |
now |
shot for DateTime.now |
TODO |
Always throws UnimplementedError stating that operation is not implemented. |
runCaching |
Executes a provided action and handles potential errors. The function returns T? which represents the result of the executed action if the action is not asynchronous. If the action completes successfully, the result is returned as is. If an exception occurs during the execution, the onError function is called with the error and stack trace. If the onError function is not provided or returns null, the error is swallowed and the result is set to null. The function returns a Future of type T? which represents the result of the executed action if the action is asynchronous. If the action completes successfully, the result is returned as is. If an exception occurs during the execution, the onError function is called with the error and stack trace. If the onError function is not provided or returns null, the error is swallowed and the result is set to null. If the onError function is synchronous, the result is returned as is. If it throws an error, the error is swallowed and the result is set to null. If the onError function is asynchronous, a Future of type T? is returned. If the onError function completes successfully, the result is returned as is. If it throws an error, the error is swallowed and the result is set to null. |
randomBool |
Generates a random boolean value. |
randomDouble |
Generates a non-negative random floating point value uniformly distributed in the range from 0.0, inclusive, to 1.0, exclusive. |
randomInt |
Generates a non-negative random integer uniformly distributed in the range rom 0, inclusive, to max , exclusive. default max is 1_000_000 |
checkNotNull |
Throws IllegalStateException if argument is null . If name is supplied, it is used as the parameter name in the error message. Returns the argument if it is not null. |
check |
Throws IllegalStateException if value is false. |
requireNotNull |
Throws IllegalArgumentException if argument is null . If message is supplied, it is used as the error message. Returns the argument if it is not null. |
require |
Throws IllegalArgumentException if value is false. If message is supplied, it is used as the error message. |
checkLeapYear |
checks whether given year is a leap year or not How to determine whether a year is a leap year To determine whether a year is a leap year, follow these steps: 1. If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5. 2. If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4. 3. If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5. 4. The year is a leap year (it has 366 days). 5. The year is not a leap year (it has 365 days). |
tryJsonDecode |
A safe json decode function that uses jsonDecode and returns null if decoding fails. |