Skip to content

Latest commit

 

History

History
516 lines (444 loc) · 67.8 KB

EXTENSIONS.md

File metadata and controls

516 lines (444 loc) · 67.8 KB

Docs

This file is auto generated. Do not edit this file manually. Last Updated: Mon, Jan 06, 2025 - 01:15 PM

Table of Contents

Extension on (26) Functions (18) Helper Classes (5) Extension Type (3)
Comparable<dynamic> post DeBouncer Degrees
Iterable<E> postDelayed IntRange Radians
Iterable<E>? now IntRangeIterator Turns
List<int> TODO IllegalArgumentException
Iterable<Iterable<E?>?>? runCaching IllegalStateException
Iterator<E> randomBool
List<E> randomDouble
Map<K, V> randomInt
DateTime buildString
Duration randomString
Object? complete
Object debounce
Iterable<T> checkNotNull
Pattern check
StringBuffer requireNotNull
bool require
double checkLeapYear
int tryJsonDecode
num
num
num?
Object?
String
String?
Directory
File

Extensions

on Comparable<dynamic>

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.

on Iterable<E>

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.
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
flatMapNotNull METHOD alias for Iterable.map
mapNotNull METHOD Similar to Iterable.map but also filters out null values.
mapNotNullIndexed METHOD Similar to List.mapIndexed, where index is also provided to the transform function, but also filters out null values.
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
toMap METHOD Alias for associate. Returns a Map containing key-value pairs provided by transform function applied to elements of the given List.
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.
countBy METHOD Returns the number of elements matching the given predicate.
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.
exceptAll 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.

on Iterable<E>?

Extension Type Description
isNullOrEmpty GETTER Returns true if this is either null or empty collection.
isBlank GETTER Alias for isNullOrEmpty. Returns true if this is either null or empty collection.
isNotBlank GETTER Alias for isNotNullOrEmpty. Returns true if this is neither null nor empty collection.
isNotNullOrEmpty GETTER Returns true if this is neither null nor empty collection.

on List<int>

Extension Type Description
toBase64 METHOD Converts the list of integers to a base64 encoded string. e.g. converting bytes to base64 string.
toUint8List METHOD Converts this list of integers to a Uint8List.
toUint16List METHOD Converts this list of integers to a Uint16List.

on Iterable<Iterable<E?>?>?

Extension Type Description
flattenedNotNull GETTER Flattens the nested iterable to a single iterable.

on Iterator<E>

Extension Type Description
next METHOD Advances the current index and returns current element

on List<E>

Extension Type Description
<< METHOD adds element into the list and returns the list
>> METHOD Removes element from the list and returns true if the element is removed.
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.
reverseIf METHOD Reverse the list if condition is true.

on Map<K, V>

Extension Type Description
reversed GETTER Returns a new Map with the keys and values reversed such that the values become keys and keys become values.
records GETTER Similar to Map.entries but returns an iterable of records instead of MapEntry.
+ 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.
findByValue METHOD Finds the first key-value pair where the value is equal to value.
findByValueOrNull METHOD Finds the first key-value pair where the value is equal to value. Returns null if no such key-value pair is found.

on DateTime

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.
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
< METHOD Returns true if this occurs before other.
> METHOD Returns true if this occurs after other.
<= METHOD Returns true if this occurs before or at the same moment as other.
>= METHOD Returns true if this occurs after or at the same moment as other.
+ 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;
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.
isSameOrBeforeDate METHOD Returns true if the date of this occurs on the same day as the date of other or before it.
isAfterDate METHOD Returns true if the date of this occurs after the date of other.
isSameOrAfterDate METHOD Returns true if the date of this occurs on the same day as the date of other or after it.
isSameDateAs METHOD Returns true if the date of this occurs on the same day as the date of other.
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.

on Duration

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.

on Object?

Extension Type Description
isTruthy GETTER Checks truthiness of the value.
isFalsy GETTER Checks false-ness of the value.
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.

on Object

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.

on Iterable<T>

Extension Type Description
byNameOrNull METHOD Same as EnumByName.byName but returns null if no value is found.

on Pattern

Extension Type Description
hasExactMatch METHOD Returns true if input exactly matches the patten.

on StringBuffer

Extension Type Description
space METHOD Appends space repeat times at the end of the buffer.
newline METHOD Appends a new line repeat times at the end of the buffer.

on bool

Extension Type Description
toggled GETTER Returns opposite of this
toInt METHOD Returns 1 if this is true and 0 if otherwise.

on double

Extension Type Description
isWhole GETTER Returns to if this has .00000 fraction points
roundToPrecision METHOD Rounds value precision number of fraction points.
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.

on int

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.
twoDigits METHOD Returns int as string which has a zero appended as prefix if this is a single digit value.
toFixedString METHOD Returns int as string which has a zero appended as prefix if this is less than width digits. e.g. 5.toFixedString(2) // returns '05' 20.toFixedString(3) // returns '020' 20.toFixedString(2) // returns '20'
rangeTo METHOD Creates an IntRange starting from this to end inclusively with default step size of 1.
downTo METHOD Creates an IntRange starting from this to end inclusively with default step size of 1.
until METHOD Returns a range from this value up to but excluding the specified end value.

on num

Extension Type Description
negative GETTER converts positive numbers into negative ones. Use abs for conversion to positive numbers.
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.

on num

Extension Type Description
degrees GETTER Creates an Degrees object from this value. This Degrees object being an extension type on double can be used everywhere double is used.
radians GETTER Creates an Radians object from this value. This Radians object being an extension type on double can be used everywhere double is used.
turns GETTER Creates an Turns object from this value. This Turns object being an extension type on double can be used everywhere
max METHOD Returns upperBound if this value is greater than or equal to upperBound, otherwise returns this value.
min METHOD Returns lowerBound if this value is less than or equal to lowerBound, Otherwise returns this value.
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.
plus METHOD Alias for add operation.
minus METHOD Alias for subtract operation.
multiply METHOD Alias for multiply operation.
divide METHOD Alias for divide operation.
mod METHOD Alias for modulo operation.

on num?

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.

on Object?

Extension Type Description
isNull GETTER Returns true if the object is null
isNotNull GETTER Returns true if the object is not null

on String

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. using characters allows to handle unicode characters that are more than 1 byte long. e.g. emojis.
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
isRegex GETTER Whether this is a valid regular expression or not. Creating an instance of RegExp with invalid patten throws a FormatException. This allows to check if a string is a valid regex pattern or not without throwing.
words GETTER This would tokenize this into words by breaking it with space.
toggledCase GETTER Toggles the case of the characters
lastIndex GETTER Returns the index of the last character in this.
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.
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.
prefix METHOD Prepends given prefix to this if it does not already start with it. If force is true, it will append the prefix regardless of whether this already starts with it or not.
suffix METHOD Appends given suffix to this if it does not already end with it. If force is true, it will append the suffix regardless of whether this already ends with it or not.
toBytes METHOD Converts this string to bytes. Default encoding is UTF-8. Use toUtf16Bytes for UTF-16 encoding.
toUtf16Bytes METHOD Converts this string to bytes using UTF-16 encoding. Use toBytes for UTF-8 encoding.
toUnicodeBytes METHOD Converts this string to bytes using Unicode encoding.
takeAfter METHOD Returns the substring after the first occurrence of pattern. Returns empty string if pattern is not found.
takeBefore METHOD Returns the substring before the first occurrence of pattern. Returns empty string if pattern is not found.
takeAfterLast METHOD Returns the substring after the last occurrence of pattern. Returns empty string if pattern is not found.
takeBeforeLast METHOD Returns the substring before the last occurrence of pattern. Returns empty string if pattern is not found.
takeBetween METHOD Returns the substring between the first occurrence of start and end. Returns empty string if start or end is not found.
take METHOD Returns the substring with the first count characters.
takeLast METHOD Returns the substring with the last count characters.

on String?

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.
matchesExactly METHOD Returns true if this string exactly matches the given pattern.

on Directory

Extension Type Description
file METHOD Not provided
subDir METHOD Not provided

on File

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
<< 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.
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.

Functions

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.
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 a max int value allowed by Random.
buildString Allows to build a string with StringBuffer using builder.
randomString Generates a random string of given length. alphabets decides whether to include alphabets or not. digits decides whether to include digits or not. specialChars decides whether to include special characters or not.
complete Waits for the given action to complete and returns the result. This is useful when an async operation doesn't support async/await and you have to use a callback-based approach that requires you to utilize a completer. This function helps you to avoid writing boilerplate code for creating a completer and returning its future.
debounce Helper function to debounce action calls using global deBouncer instance. If immediateFirstRun is set to true, it will run the action immediately for the first call and then it will wait for duration to run the next call if there's any.
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:
tryJsonDecode A safe json decode function that uses jsonDecode and returns null if decoding fails.

Helper Classes

Name Description
DeBouncer de-bounces run method calls and runs it only once in given duration. It will ignore any calls to run until duration has passed since the last call to run. It can be used to de-bounce any method calls like search, filter, etc.
IntRange A progression of values of type int. An iterable that can iterate between start and end value with step size of step.
IntRangeIterator An iterator over a progression of values of type int. Iterable that gives items between start and end with step size step. It iterates through given range with step size step. Default value of step is 1. This implementation is end inclusive, meaning that the end value is also a part of the range. For
IllegalArgumentException Thrown to indicate that a method has been passed an illegal or inappropriate argument.
IllegalStateException Signals that a method has been invoked at an illegal or inappropriate time.

Extensions Types

Degrees

Field/Method Type Description
inRadians GETTER Returns the value of this angle in radians with Radians extension type.
inTurns GETTER Returns the value of this angle in turns with Turns extension type.

Radians

Field/Method Type Description
inDegrees GETTER Returns the value of this angle in degrees with Degrees extension type.
inTurns GETTER Returns the value of this angle in turns with Turns extension type.

Turns

Field/Method Type Description
inDegrees GETTER Returns the value of this angle in degrees with Degrees extension type.
inRadians GETTER Returns the value of this angle in radians with Radians extension type.