flutter_elemental
library
Classes
-
AsyncContext<E, A>
-
-
Atom<T>
-
The base class for all atoms.
-
AtomBuilder
-
-
AtomConfigMixin<A extends Atom>
-
-
AtomContext<T>
-
Passed to the Atom.$read method, allowing you to interact with other atoms
and manage the lifecycle of your state.
-
AtomInitialValue<A>
-
Returned from Atom.withInitialValue for passing to a AtomRegistry or
AtomScope.
-
AtomRegistry
-
Responsible for mapping atom's to their state.
-
AtomScope
-
-
AtomWithParent<A, Parent extends Atom>
-
-
AtomWithParentBase<A, Parent extends Atom>
-
See atomWithParent.
-
CanBeEmpty
-
Your own classes can implement this so they may use
CanBeEmptyExtension
.
-
Cause<E>
-
Represents the error channel of a ZIO.
-
ConfigList
-
- If isDeepEquals is
false
, the IList equals operator (==
) compares by identity.
- If isDeepEquals is
true
(the default), the IList equals operator (==
) compares all
items, ordered.
- If cacheHashCode is
true
(the default), the IList will only calculate the hashCode
once, when it is asked — initially, internally null
. Otherwise, it will always recalculate it.
-
ConfigMap
-
- If isDeepEquals is
false
, the IMap equals operator (==
) compares by identity.
- If isDeepEquals is
true
(the default), the IMap equals operator (==
) compares all entries, ordered.
- If sort is
true
, will sort the list output of keys. Otherwise, it will keep the insertion order (the default).
- If cacheHashCode is
true
(the default), the IMap will only calculate the hashCode
once, when it is asked — initially, internally null
. Otherwise, it will always recalculate it.
-
ConfigMapOfSets
-
- If isDeepEquals is
false
, the IMap equals operator (==
) compares by identity.
- If isDeepEquals is
true
(the default), the IMap equals operator (==
) compares all entries, ordered.
- If sortKeys is
true
, will sort the list output of keys. Otherwise, it will keep the insertion order (the default).
- If cacheHashCode is
true
(the default), the IMapOfSets will only calculate the
hashCode once, when it is asked — initially, internally null
. Otherwise, it will always recalculate it.
-
ConfigSet
-
The set configuration.
-
Defect<E>
-
Represents an uncaught error.
-
Deferred<E, A>
-
A Deferred is represents a value that may not be available yet.
-
Dequeue<A>
-
-
DiffAndIntersectResult<T, G>
-
-
DoContext<R, E>
-
-
Either<L, R>
-
Represents a value of one of two possible types, Left or Right.
-
Enqueue<A>
-
-
Entry<K, V>
-
Similar to a MapEntry, but correctly implements
equals (== comparing key and value),
hashcode
and Comparable.compareTo.
-
Failure<E>
-
Represents a failure with an error of type
E
.
-
Fiber<R, E, A>
-
While elemental does not have a fiber runtime, Fiber is used to abstract
the running of ZIO's in the background.
-
FutureData<A>
-
Represents the case where an async operation succeeds, and has returned a
some data.
-
FutureError<A>
-
Represents the case where an async operation fails, and has returned an
error.
-
FutureLoading<A>
-
Represents the case where an async operation is waiting for a result.
-
FutureValue<A>
-
Represents the loading, error and data state of an async operation.
-
Guarded<A>
-
A Guarded is a wrapper around a value that can only be accessed by a
by the specified number of
permits
(defaults to 1), at any given time.
-
IList<T>
-
An immutable list.
Note: The replace method is the equivalent of
operator []=
for the IList.
-
IListConst<T>
-
This is an IList which can be made constant.
Note: Don't ever use it without the "const" keyword, because it will be unsafe.
-
IListOf2<T>
-
An immutable list of only 2 items.
-
IListOf3<T>
-
An immutable list of only 3 items.
-
IListOf4<T>
-
An immutable list of only 4 items.
-
IMap<K, V>
-
An immutable, unordered map.
-
IMapConst<K, V>
-
This is an IMap which can be made constant.
Note: Don't ever use it without the "const" keyword, because it will be unsafe.
-
IMapOfSets<K, V>
-
An immutable, unordered, map of sets.
-
IMapOfSetsConst<K, V>
-
-
ImmutableCollection<C>
-
-
Interrupted<E>
-
Interrupted is used to indicated that a ZIO was interrupted.
-
ISet<T>
-
An immutable, ordered set.
It can be configured to order by insertion order, or sort.
-
ISetConst<T>
-
This is an ISet which can be made constant.
Note: Don't ever use it without the "const" keyword, because it will be unsafe.
-
IZIO<R, E, A>
-
-
Layer<E, Service>
-
A Layer can be used to construct a service.
-
LayerContext
-
-
Left<L, R>
-
-
ListMap<K, V>
-
A ListMap is a mutable, fixed-sized, and ordered map.
-
ListMapView<K, V>
-
A ListMapView lets you view a regular map as if it was a ListMap.
At the moment this class is for FIC's internal use only, since a lot of
its methods will throw UnsupportedError.
-
ListSet<T>
-
A ListSet is, at the same time:
-
ListSetView<T>
-
-
Logger
-
-
MapEntryEquality<E>
-
This works for any object, not only map entries, but
MapEntry
gets special
treatment. We consider two map-entries equal when their respective key and
values are equal.
-
MemoryNucleusStorage
-
-
ModifiableListFromIList<T>
-
The ModifiableListFromIList is a safe, modifiable List that is built from an IList.
The construction of the list is fast at first, since it makes no copies of the
IList items, but just uses it directly.
-
ModifiableMapFromIMap<K, V>
-
The ModifiableMapFromIMap is a safe, modifiable Map that is built from an IMap.
The construction of the map is fast at first, since it makes no copies of the
IMap items, but just uses it directly.
-
ModifiableSetFromISet<T>
-
The ModifiableSetFromISet is a safe, modifiable Set that is built from an ISet.
The construction of the set is fast at first, since it makes no copies of the
ISet items, but just uses it directly.
-
NoEnv
-
Represents the absence of an environment
-
None
-
-
NucleusStorage
-
-
Option<T>
-
A type that can contain a value of type
T
in a Some or no value with None.
-
Order<T>
-
The
Order
type class is used to define a total ordering
on some type A
.
-
Output<T>
-
Meant to be used when you wish to save a value that's going to be tossed
out of an immutable collection.
-
ReadOnlyAtom<T>
-
See atom.
-
ReadOnlyAtomBase<Value>
-
See atom.
-
Ref<A>
-
A Ref holds a value of type
A
and allows to modify it atomically.
-
RefreshableAtomWithParent<A, Parent extends Atom>
-
See atomWithParent.
-
RefreshableReadOnlyAtom<T>
-
See atom.
-
RefreshableWritableAtom<R, W>
-
Represents an Atom that can be written to.
-
ReversedListView<T>
-
Returns a List of the objects in this list in reverse order.
Very efficient since it returns a view, which means if you change the
original list this one will also change, and vice-versa.
-
Right<L, R>
-
-
Runtime
-
-
Schedule<R, E, I, O>
-
-
ScheduleDriver<R, E, I, O>
-
-
Scope<R>
-
-
Semaphore
-
A semaphore is a concurrency primitive that allows you to limit the number
of concurrent operations.
-
SharedPrefsError
-
-
SharedPrefsStorage
-
-
Some<T>
-
-
StateAtom<R>
-
Represents an Atom that can be written to.
-
StorageRef<A>
-
A variant of Ref, that stores its value in a NucleusStorage.
-
Unit
-
Used instead of
void
as a return statement for a function when no value is to be returned.
-
UnmodifiableListFromIList<T>
-
The UnmodifiableListFromIList is a relatively safe, unmodifiable List view that is built
from an IList or another List. The construction of the UnmodifiableListFromIList is very
fast, since it makes no copies of the given list items, but just uses it directly.
-
UnmodifiableMapFromIMap<K, V>
-
The UnmodifiableMapFromIMap is a relatively safe, unmodifiable Map that is built from an
IMap or another Map. The construction of the UnmodifiableMapFromIMap is very fast,
since it makes no copies of the given map items, but just uses it directly.
-
UnmodifiableSetFromISet<T>
-
The UnmodifiableSetFromISet is a relatively safe, unmodifiable Set view that is built from
an ISet or another Set. The construction of the UnmodifiableSetFromISet is very fast,
since it makes no copies of the given set items, but just uses it directly.
-
WritableAtom<R, W>
-
Represents an Atom that can be written to.
-
WritableAtomBase<R, W>
-
Represents an Atom that can be written to.
-
ZIO<R, E, A>
-
Represents an operation that can fail with requirements
-
ZIOContext<R>
-
Represents the context in which a ZIO is executed.
-
ZIOQueue<A>
-
An asynchronous queue. It is backed by a ListQueue and a linked list of DeferredIOs.
-
ZIORunner<E, A>
-
-
ZIORunnerState<E, A>
-
Mixins
-
FromIListMixin<T, I extends FromIListMixin<T, I>>
-
This mixin implements all IList methods (without
config
(ConfigList)), plus
operator []
, but it does NOT implement Iterable nor IList.
-
FromISetMixin<T, I extends FromISetMixin<T, I>>
-
This mixin implements all ISet members (without config),
but it does NOT implement Iterable nor ISet.
-
FromIterableIListMixin<T>
-
This mixin implements all Iterable methods, plus
operator []
,
but it does NOT implement Iterable nor IList.
-
FromIterableISetMixin<T>
-
This mixin implements all Iterable methods,
but it does NOT implement Iterable nor ISet.
-
RefreshableAtom
-
-
RefreshableAtomMixin<A extends RefreshableAtom>
-
-
ScopeMixin
-
Extensions
-
AtomExtension
on Atom<A>
-
-
ChainExtension
on T
-
-
ComposeExtension0
on A Function()
-
-
ComposeExtension1
on B Function(A)
-
-
ComposeExtension2
on C Function(A, B)
-
-
ComposeExtension3
on D Function(A, B, C)
-
-
ComposeExtension4
on E Function(A, B, C, D)
-
-
EIOLiftExt
on EIO<E, A>
-
-
EIORunnerExt
on EIO<E, A>
-
-
EitherExitExt
on Either<E, A>
-
-
ElementalNavigatorExt
on NavigatorState
-
-
ElementalOnIterable
on Iterable<T>
-
Get the first element of the Iterable.
If the Iterable is empty, return None.
Functional programming functions on a mutable dart Iterable using
elemental
.
-
ElementalOnIterableOfIterable
on Iterable<Iterable<T>>
-
Functional programming functions on
Iterable<Iterable<T>>
using elemental
.
-
ElementalOnMap
on Map<K, V>
-
-
ElementalOnOptionMap
on Option<Map<K, dynamic>>
-
-
ElementalOnPredicate
on bool Function()
-
-
ElementalOnPredicate1
on bool Function(P)
-
-
ExitExt
on Exit<E, A>
-
-
FicBooleanExtension
on bool
-
See also: compareObject, FicComparableExtension, FicComparatorExtension, sortBy, sortLike
-
FicComparableExtension
on Object?
-
-
FicComparatorExtension
on int
-
The if0
extension
lets you nest comparators. For example:
-
FicIterableExtension
on Iterable<T>
-
See also: FicListExtension, FicSetExtension
-
FicIterableExtensionTypeNullable
on Iterable<T?>
-
See also: FicListExtension, FicSetExtension
-
FicIterableOfMapEntryExtension
on Iterable<MapEntry<K, V>>
-
-
FicIteratorExtension
on Iterator<T>
-
See also: FicIterableExtension
-
FicListExtension
on List<T>
-
-
FicListExtensionNullable
on List<T?>
-
-
FicMapEntryExtension
on MapEntry<K, V>
-
-
FicMapExtension
on Map<K, V>
-
See also: FicMapOfSetsExtension
-
FicMapIteratorExtension
on Iterator<MapEntry<K, V>>
-
See also: FicIterableExtension, FicIteratorExtension
-
FicMapOfSetsExtension
on Map<K, Set<V>>
-
See also: FicMapExtension
-
FicNumberExtension
on T
-
-
FicNumberExtensionNullable
on T?
-
-
FicObjectExtension
on Object?
-
-
FicSetExtension
on Set<T>
-
See also: FicListExtension
-
FICZipExtension
on Iterable<Tuple2<U, V>>
-
-
FutureValueAtomExtension
on Atom<FutureValue<A>>
-
-
FutureValueAtomWithParentExtension
on AtomWithParentBase<FutureValue<A>, Parent>
-
-
IOLiftExt
on IO<A>
-
-
NucleusBuildContextExt
on BuildContext
-
-
OptionExtension
on Option<T>
-
-
RIOLiftExt
on RIO<R, A>
-
-
SchedultLiftEIOExt
on Schedule<NoEnv, E, dynamic, O>
-
-
SchedultLiftIOExt
on Schedule<NoEnv, Never, dynamic, O>
-
-
SchedultLiftRIOExt
on Schedule<R, Never, dynamic, O>
-
-
ZIOAskExt
on ZIO<NoEnv, E, A>
-
-
ZIOAtomContextExt
on AtomContext
-
-
ZIOBuildContextRunExt
on EIO<E, A>
-
-
ZIOEitherExt
on Either<E, A>
-
-
ZIOFinalizerExt
on ZIO<R, E, A>
-
-
ZIOFinalizerNoEnvExt
on ZIO<R, E, A>
-
-
ZIOForkExt
on ZIO<R, E, A>
-
-
ZIOIterableExt
on Iterable<IZIO<R, E, A>>
-
-
ZIOLiftScopeExt
on ZIO<Scope<NoEnv>, E, A>
-
-
ZIONoneExt
on RIOOption<R, A>
-
-
ZIOOptionExt
on Option<A>
-
-
ZIOScopeExt
on ZIO<Scope<R>, E, A>
-
Functions
-
areImmutableCollectionsWithEqualItems(ImmutableCollection? c1, ImmutableCollection? c2)
→ bool
-
Will return
true
only if the collections are of the same type, and their
items are equal by calling the collection's equalItems
method. This may be
slow for very large collection, since it compares each item, one by one.
Note this will not compare the collection configuration.
-
areSameImmutableCollection(ImmutableCollection? c1, ImmutableCollection? c2)
→ bool
-
While
identical(collection1, collection2)
will compare the collections by
identity, areSameImmutableCollection(collection1, collection2)
will
compare them by type, and then by their internal state. Note this is
practically as fast as identical
, but will give less false negatives.
So it is almost always recommended to use areSameImmutableCollection
instead of identical
.
-
atom<Value>(AtomReader<Value> create)
→ ReadOnlyAtom<Value>
-
Create a read only atom that can interact with other atom's to create
derived state.
-
atomFamily<A extends Atom, Arg>(A create(Arg arg))
→ A Function(Arg arg)
-
Create a family factory function, for indexing similar atoms with the
Arg
type.
-
atomIdMap<T, Id, A extends Atom<T>>(A create(T item), {required Id id(T item)})
→ Map<Id, A> Function(Iterable<T> items)
-
-
atomWithParent<A, Parent extends Atom>(Parent parent, A create(AtomContext<A> get, Parent parent))
→ AtomWithParent<A, Parent>
-
Create an Atom that is linked to a parent Atom.
-
atomWithStorage<R, A>(AtomWithStorageCreate<R, A> create, {required String key, required Atom<NucleusStorage> storage, required A fromJson(dynamic json), required dynamic toJson(A a)})
→ ReadOnlyAtom<R>
-
Create an atom that can read and write to a NucleusStorage instance.
-
changeNotifierAtom<T, N extends ChangeNotifier>(AtomReader<N> create, T select(N notifier))
→ AtomWithParent<T, Atom<N>>
-
Create an AtomWithParent for a ChangeNotifier, which exposes a value
using the given
select
function.
-
combineIterables<A, B, R>(Iterable<A> a, Iterable<B> b, R combine(A, B), {bool allowDifferentSizes = false})
→ Iterable<R>
-
Combines iterables
a
and b
into one, by applying the combine
function.
If allowDifferentSizes
is true, it will stop as soon as one of the
iterables has no more values. If allowDifferentSizes
is false, it will
throw an error if the iterables have different length.
-
compareObject<T extends Object>(Object? a, Object? b, {bool nullsBefore = false})
→ int
-
The compareObject comparator is similar to the natural comparator
provided by Comparable objects in their Comparable.compareTo method,
to sort objects in their "natural order". The difference here is that
compareObject is also able to compare some objects which are not
Comparable, such as bool, MapEntry, Enum, and nulls.
-
futureAtom<A>(AtomReader<Future<A>> create)
→ FutureAtom<A>
-
Create an AtomWithParent that returns a FutureValue representing the
current state of the Future's execution.
-
identity<T>(T a)
→ T
-
Returns the given
a
.
-
left<L, R>(L l)
→ Either<L, R>
-
Return a
Left(l)
.
-
memo1<A, R>(R f(A))
→ R Function(A)
-
memo-ize the given function, caching the return result.
-
memo2<A, B, R>(R f(A, B))
→ R Function(A, B)
-
memo-ize the given function, caching the return result.
-
memo3<A, B, C, R>(R f(A, B, C))
→ R Function(A, B, C)
-
memo-ize the given function, caching the return result.
-
memo4<A, B, C, D, R>(R f(A, B, C, D))
→ R Function(A, B, C, D)
-
memo-ize the given function, caching the return result.
-
right<L, R>(R r)
→ Either<L, R>
-
Return a
Right(r)
.
-
runtimeInitialValue(Iterable<Layer> layers, {LogLevel? logLevel, Logger? logger})
→ Future<AtomInitialValue<Runtime>>
-
-
sortBy<T>(Predicate<T> test, {int then(T, T)?})
→ int Function(T, T)
-
The sortBy function can be used to create a comparator to sort
collections, comparing
a
and b
such that:
-
sortLike<T, E>(Iterable<E> order, {E mapper(T)?, int then(T, T)?})
→ int Function(T, T)
-
The sortLike function can be used to create a comparator to sort
collections, comparing
a
and b
such that:
-
stateAtom<Value>(Value initialValue)
→ WritableAtom<Value, Value>
-
Create a simple atom with mutable state.
-
stateAtomWithStorage<A>(A initialValue, {required Atom<NucleusStorage> storage, required String key, required A fromJson(dynamic json), required dynamic toJson(A a)})
→ WritableAtom<A, A>
-
Create a stateAtom, except it's value is persisted to a NucleusStorage
instance.
-
streamAtom<A>(AtomReader<Stream<A>> create, {A? initialValue})
→ StreamAtom<A>
-
-
useAtom<A>(Atom<A> atom, {bool listen = true})
→ A
-
-
useLayer<E, A>(Layer<E, A> layer)
→ EIO<E, A>
-
-
useLayerContext()
→ LayerContext
-
-
useLayerRunner<E, A>(Layer<E, A> layer)
→ ZIORunnerState<E, A>
-
-
useZIO<E, A>(EIO<E, A> zio, [List<Object?> keys = const [], bool logFailures = true])
→ FutureOr<Exit<E, A>> Function()
-
-
useZIO1<E, A, T>(EIO<E, A> f(T _), [List<Object?> keys = const [], bool logFailures = true])
→ FutureOr<Exit<E, A>> Function(T _)
-
-
useZIO2<E, A, T, U>(EIO<E, A> f(T t, U u), [List<Object?> keys = const [], bool logFailures = true])
→ FutureOr<Exit<E, A>> Function(T t, U u)
-
-
useZIORef<A>(Ref<A> ref)
→ A
-
-
useZIORunner<E, A>(EIO<E, A> zio, {List<Object?> keys = const [], bool runImmediately = false})
→ ZIORunner<E, A>
-
-
valueListenableAtom<T>(ValueListenable<T> create(AtomContext<ValueListenable<T>> get))
→ AtomWithParent<T, Atom<ValueListenable<T>>>
-
Create an Atom that listens to a ValueListenable.
-
valueNotifierAtom<T, N extends ValueNotifier<T>>(AtomReader<N> create)
→ AtomWithParent<T, Atom<N>>
-
Create an AtomWithParent for a ValueNotifier, which exposes the latest
value.
-
weakAtomFamily<A extends Atom, Arg>(A create(Arg arg))
→ A Function(Arg arg)
-
Alternate version of atomFamily that holds a weak reference to each child.
-
writableAtom<R, W>(AtomReader<R> reader, AtomWriter<R, W> writer)
→ WritableAtom<R, W>
-
Creates an WritableAtom that can be used to implement custom write logic.
-
zioAtom<E, A>(EIO<E, A> zio, {bool runImmediately = true})
→ AtomWithParent<ZIORunnerState<E, A>, Atom<ZIORunner<E, A>>>
-
Creates an Atom of ZIORunnerState's from the given ZIO.
-
zioRefAtomSync<E, A>(EIO<E, Ref<A>> zio)
→ AtomWithParent<A, Atom<Ref<A>>>
-
Creates an Atom from a Ref contained in a ZIO. It will throw an error
if the Ref cannot be accessed synchronously.
Typedefs
-
AtomReader<R>
= R Function(AtomContext<R> get)
-
A function that creates a value from an AtomContext
-
AtomWithStorageCreate<R, A>
= R Function(AtomContext<R> get, A? read(), void write(A value))
-
-
AtomWriter<R, W>
= void Function(GetAtom get, SetAtom set, SetSelf<R> setSelf, W value)
-
Represents the
writer
argument to writableAtom
-
BuildContextEIO<E, A>
= ZIO<BuildContext, E, A>
-
A ZIO that requires a BuildContext to run.
-
BuildContextIO<A>
= ZIO<BuildContext, Never, A>
-
A ZIO that requires a BuildContext to run, and never fails.
-
BuildContextIOOption<A>
= RIOOption<BuildContext, A>
-
A ZIO that requires a BuildContext to run, and has an optional value.
-
DeferredIO<A>
= Deferred<Never, A>
-
Represents a Deferred that can't fail.
-
DoAdapterEither<L>
= R Function<R>(Either<L, R>)
-
-
DoAdapterOption
= A Function<A>(Option<A>)
-
-
DoFunction<R, E, A>
= FutureOr<A> Function(DoContext<R, E> $, R env)
-
A function that can be used in a ZIO.Do.
-
DoFunctionEither<L, R>
= R Function(DoAdapterEither<L> $)
-
-
DoFunctionOption<A>
= A Function(DoAdapterOption $)
-
-
EIO<E, A>
= ZIO<NoEnv, E, A>
-
Represents an operation that can fail, with no requirements
-
EQ<T, U>
= bool Function(T item, U other)
-
-
Exit<E, A>
= Either<Cause<E>, A>
-
The result of a ZIO computation.
-
FutureAtom<A>
= AtomWithParent<FutureValue<A>, Atom<Future<A>>>
-
Represents an AtomWithParent for an async operation.
-
GetAtom
= A Function<A>(Atom<A> atom)
-
Represents a function that retrieves an Atom's value.
-
IO<A>
= ZIO<NoEnv, Never, A>
-
Represents an operation that cant fail, with no requirements
-
IOOption<A>
= ZIO<NoEnv, None, A>
-
Represents an operation that represent an optional value
-
Op<T>
= T Function(T element)
-
Operation of type that conserve the original type
-
RIO<R, A>
= ZIO<R, Never, A>
-
Represents an operation that cant fail, with
R
requirements
-
RIOOption<R, A>
= ZIO<R, None, A>
-
Represents an operation that represent an optional value
-
SetAtom
= void Function<R, W>(WritableAtom<R, W> atom, W value)
-
Represents a function that sets a WritableAtom's value.
-
SetSelf<A>
= void Function(A value)
-
Represents function that sets the current atom's value
-
StreamAtom<A>
= AtomWithParent<FutureValue<A>, Atom<Stream<A>>>
-
Represents an AtomWithParent for a streaming operation.
-
WidgetAtomReader
= Widget Function(BuildContext context, AtomContext<Widget> get, Widget? child)
-