Arr<T> extension type

A fixed-size array, denoted as T; N in Rust.

on
Implemented types
Available extensions

Constructors

Arr.new(T defaultVal, int size)
Arr.constant(List<T> _list)
const
Arr.empty()
Arr.fromList(List<T> _list)
Arr.generate(int length, T generator(int))

Properties

first → T
The first element.
no setterinherited
firstOrNull → T?

Available on Iterable<T>, provided by the IterableExtensions extension

The first element of this iterator, or null if the iterable is empty.
no setter
firstOrOption Option<T>
Returns the first element of an iterator, None if empty.
no setter
hashCode int
The hash code for this object.
no setterinherited
indexed Iterable<(int, T)>

Available on Iterable<T>, provided by the IterableExtensions extension

Pairs of elements of the indices and elements of this iterable.
no setter
isEmpty bool
Whether this collection has no elements.
no setterinherited
isNotEmpty bool
Whether this collection has at least one element.
no setterinherited
iterator Iterator<T>
A new Iterator that allows iterating the elements of this Iterable.
no setteroverride
last → T
The last element.
no setterinherited
lastOrNull → T?

Available on Iterable<T>, provided by the IterableExtensions extension

The last element of this iterable, or null if the iterable is empty.
no setter
lastOrOption Option<T>
Returns the last element of an iterator, None if empty.
no setter
length int
The number of elements in this Iterable.
no setterinherited
nonNulls Iterable<T>

Available on Iterable<T?>, provided by the NullableIterableExtensions extension

The non-null elements of this iterable.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single → T
Checks that this iterable has only one element, and returns that element.
no setterinherited
singleOrNull → T?
Returns the single element of an iterator, null if this is empty or has more than one element.
no setter
singleOrNull → T?

Available on Iterable<T>, provided by the IterableExtensions extension

The single element of this iterator, or null.
no setter
singleOrOption Option<T>
Returns the single element of an iterator, None if this is empty or has more than one element.
no setter
wait Future<List<T>>

Available on Iterable<Future<T>>, provided by the FutureIterable extension

Waits for futures in parallel.
no setter

Methods

any(bool test(T element)) bool
Checks whether any element of this iterable satisfies test.
inherited
asList() List<T>
asNameMap() Map<String, T>

Available on Iterable<T>, provided by the EnumByName extension

Creates a map from the names of enum values to the values.
asSlice() Slice<T>
asVec() Vec<T>

Available on Arr<T>, provided by the Vec$ArrExtension extension

byName(String name) → T

Available on Iterable<T>, provided by the EnumByName extension

Finds the enum value in this list with name name.
call(RangeBounds range) Slice<T>
cast<U>() Arr<U>
Casts this Arr
override
contains(Object? element) bool
Whether the collection contains an element equal to element.
inherited
elementAt(int index) → T
Returns the indexth element.
inherited
elementAtOrNull(int index) → T?

Available on Iterable<T>, provided by the IterableExtensions extension

The element at position index of this iterable, or null.
every(bool test(T element)) bool
Checks whether every element of this iterable satisfies test.
inherited
expand<U>(Iterable<U> f(T)) Iter<U>
Expands each element of this Iterable into zero or more elements.
override
firstWhere(bool test(T element), {T orElse()?}) → T
The first element that satisfies the given predicate test.
inherited
fold<T>(T initialValue, T combine(T previousValue, T element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value
inherited
followedBy(Iterable<T> other) Iter<T>
Creates the lazy concatenation of this iterable and other.
override
forEach(void action(T element)) → void
Invokes action on each element of this iterable in iteration order.
inherited
isEmpty() bool
Returns true if the iterator is empty, false otherwise.
isNotEmpty() bool
Returns true if the iterator is not empty, false otherwise.
iter() Iter<T>

Available on Iterable<T>, provided by the Iter$IterableExtension extension

Returns an Iter over the Iterable.
join([String separator = ""]) String
Converts each element to a String and concatenates the strings.
inherited
lastWhere(bool test(T element), {T orElse()?}) → T
The last element that satisfies the given predicate test.
inherited
len() int
Returns the length of an iterator.
map<U>(U f(T)) Arr<U>
Returns an array of the same size as self, with function f applied to each element in order.
override
merge() Result<List<S>>

Available on Iterable<Result<S>>, provided by the AnyhowIterableResultExtension extension

Merges an Iterable of results into a single result where the Ok value is the list of all successes. If any Error is encountered, the first Error becomes the root to the rest of the Errors. Similar to toResult.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reduce(T combine(T value, T element)) → T
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
inherited
rsplitSlice(int index) → (Slice<T>, Slice<T>)
Divides array into two Slices at index from end. The first will contain all indices from [0, N - M) (excluding the index N - M itself) and the second will contain all indices from [N - M, N) (excluding the index N itself).
singleWhere(bool test(T element), {T orElse()?}) → T
The single element that satisfies test.
inherited
skip(int count) Iter<T>
Creates an Iterable that provides all but the first count elements.
override
skipWhile(bool f(T)) Iter<T>
Creates an Iterable that skips leading elements while test is satisfied.
override
slice([int start = 0, int? end]) Slice<T>
splitSlice(int index) → (Slice<T>, Slice<T>)
Divides array into two Slices at index from start. The first will contain all indices from [0, M) (excluding the index M itself) and the second will contain all indices from [M, N) (excluding the index N itself).
take(int count) Iter<T>
Creates a lazy iterable of the count first elements of this iterable.
override
takeWhile(bool f(T)) Iter<T>
Creates a lazy iterable of the leading elements satisfying test.
override
toArr() Arr<T>

Available on Iterable<T>, provided by the Array$IterableExtension extension

Creates an Array from an Iterable
toList({bool growable = true}) List<T>
Creates a List containing the elements of this Iterable.
inherited
toNullables() Iterable<T?>

Available on Iterable<Option<T>>, provided by the Iter$IterableOption extension

toOptions() Iterable<Option<T>>

Available on Iterable<T?>, provided by the Iter$IterableNullable extension

toResult() Result<List<S>>

Available on Iterable<Result<S>>, provided by the AnyhowIterableResultExtension extension

Transforms an Iterable of results into a single result where the Ok value is the list of all successes. The Err type is an Error with list of all errors List<Error>. Similar to merge.
toResult() → FutureResult<List<S>, List<F>>

Available on Iterable<FutureResult<S, F>>, provided by the Result$IterableFutureResultExtension extension

Transforms an Iterable of FutureResults into a single result where the ok value is the list of all successes and err value is a list of all failures. The order of S and F is determined by the order in the List.
toResult() → Result<List<S>, List<F>>

Available on Iterable<Result<S, F>>, provided by the Result$IterableResultExtension extension

Transforms an Iterable of results into a single result where the ok value is the list of all successes and err value is a list of all failures.
toResultEager() → FutureResult<List<S>, F>

Available on Iterable<FutureResult<S, F>>, provided by the Result$IterableFutureResultExtension extension

Transforms an Iterable of FutureResults into a single result where the ok value is the list of all successes. If any error is encountered, the first error is used as the error result. The order of S and F is determined by the order in which futures complete.
toResultEager() → Result<List<S>, F>

Available on Iterable<Result<S, F>>, provided by the Result$IterableResultExtension extension

Transforms an Iterable of results into a single result where the ok value is the list of all successes. If any error is encountered, the first error is used as the error result.
toSet() Set<T>
Creates a Set containing the same elements as this iterable.
inherited
toString() String
Returns a string representation of (some of) the elements of this.
inherited
toVec() Vec<T>

Available on Iterable<T>, provided by the Vec$IterableExtension extension

tryMap<S, F extends Object>(Result<S, F> f(T)) → Result<Arr<S>, F>
A fallible function f applied to each element on this array in order to return an array the same size as this or the first error encountered.
where(bool f(T)) Iter<T>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
override
whereType<U>() Iter<U>
Creates a new lazy Iterable with all elements that have type T.
override

Operators

operator +(Arr<T> other) → dynamic
operator ==(Object other) bool
The equality operator.
inherited
operator [](int index) → T
operator []=(int index, T value) → void

Static Methods

range(int start, int end, {int step = 1}) Arr<int>
An array of int in the range [start..end), where start >= end or start <= end. step must be positive.