Arr<T>
extension type
A fixed-size array, denoted as T; N
in Rust.
Constructors
- Arr(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
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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 thisIterable
.no setteroverride - last → T
-
The last element.
no setterinherited
- length → int
-
The number of elements in this Iterable.
no setterinherited
- 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
Methods
-
any(
bool test(T element)) → bool -
Checks whether any element of this iterable satisfies
test
.inherited -
asList(
) → List< T> -
asSlice(
) → Slice< T> -
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
index
th element.inherited -
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
-
first(
) → Option< T> - Returns the first element of an iterator, None if empty.
-
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.
-
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
inherited
-
last(
) → Option< T> - Returns the last element of an iterator, None if empty.
-
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
-
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).
-
single(
) → Option< T> - Returns the single element of an iterator, None if this is empty or has more than one element.
-
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 whiletest
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 -
toList(
{bool growable = true}) → List< T> -
Creates a List containing the elements of this Iterable.
inherited
-
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 -
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