convenient_architecture library
The collection of useful utils and architecture base classes.
Classes
-
BlocArgEvent<
T> - BlocEvent
-
CommonErrorStateAdapter<
Event, Data> -
State adapter which catches errors from the
requestAction
and returns the Either of theData
or GeneralFailure. -
CommonErrorVoidStateAdapter<
Event> -
CommonVoidErrorStateAdapter<
Event, Data> -
State adapter which catches errors from the
requestAction
and returns the Option of the GeneralFailure. - Disposable
- Interface for classes which wants to release any resources retained by this object.
-
Either<
L, R> - Represents a value of one of two possible types, Left or Right.
-
Eq<
T> -
A type class used to determine equality between 2 instances of the same type
T
. Any 2 instancesx
andy
are equal ifeqv(x, y)
istrue
. -
FacadeConsumerCubit<
T> - Base for the cubit which listens to the ReactiveFacade.dataStream.
-
FacadeConsumerState<
Data> -
FpStateAdapter<
Event, Data, Failure> - Implementation of the IStateAdapter for actions which are returns Either.
-
FpVoidStateAdapter<
Event, Failure> - Implementation of the IStateAdapter for actions which are returns Option.
- GeneralFailure
-
Hash<
T> - A type class used to represent a hashing scheme for objects of a given type.
-
HKT<
G, A> - https://marcosh.github.io/post/2020/04/15/higher-kinded-types-php-solution.html https://medium.com/@gcanti/higher-kinded-types-in-flow-275b657992b7
-
HKT2<
G1, G2, A> -
HKT3<
G1, G2, G3, A> -
IActionBloc<
Event, Response, Data, Failure> -
Action bloc is used to automatically map
action
that returns someData
to the states. -
IActionBlocState<
Data, Failure> -
IO<
A> -
IO<A>
represents a non-deterministic synchronous computation that can cause side effects, yields a value of typeA
and never fails. -
IOEither<
L, R> -
IOEither<L, R>
represents a non-deterministic synchronous computation that can cause side effects, yields a value of typeR
or can fail by returning a value of typeL
. -
IOOption<
R> -
IOOption<R>
represents an synchronous computation that may fails yielding a None or returns aSome(R)
when successful. -
IORef<
T> - Mutable reference in the IO monad.
-
IStateAdapter<
Event, Response, Data, Failure> -
State adapter is used to call the
requestAction
and map its result to theResponse
. -
IVoidActionBloc<
Event, Response, Failure> -
Void action bloc is used to automatically map
action
that doesn't return any value to the states. -
IVoidActionBlocState<
Failure> -
IVoidStateAdapter<
Event, Response, Failure> -
Left<
L, R> - None
-
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 typeA
. -
PaginationInfo<
T> - Holder for the list of paginated data. It holds items and canLoadMore flag which is usually used by the UI to show the loading indicator at the end of the list, and to as to load more data.
-
PartialOrder<
T> -
The
PartialOrder
type class is used to define a partial ordering on some typeA
. -
ReactiveFacade<
T> - Base for the most facades.
-
ReactiveFacadeWithDefault<
T> - The same as ReactiveFacade but its data can't be null.
-
ReactiveListFacade<
T> -
Shortcut for the ReactiveFacadeWithDefault with the List of
T
. -
ReactivePaginationFacade<
T> - Facade for the paginated data.
-
Reader<
R, A> -
Reader<R, A>
allows to read valuesA
from a dependency/contextR
without explicitly passing the dependency between multiple nested function calls. - ReaderHKT
- Tag the HKT2 interface for the actual Reader.
-
ReaderTask<
E, A> -
ReaderTask represents an asynchronous computation that yields a value of type
A
from a context of typeE
and never fails. -
ReaderTaskEither<
E, L, R> -
ReaderTaskEither<E, L, R>
represents an asynchronous computation (Task
) that either yields a value of typeR
or fails yielding an error of typeL
(Either
), that allows to read values from a dependency/contextE
(Reader
). -
ResponseParser<
Response, Failure> - Response Parser makes it easier to parse data and error response from server.
-
ResponseParserBase<
Response, Failure> - Response Parser makes it easier to parse data and error response from server.
-
Right<
L, R> -
Some<
T> -
StateAsync<
S, A> -
StateAsync<S, A>
is used to store, update, and extract async state in a functional way. -
Task<
A> -
Task represents an asynchronous computation that yields a value of type
A
and never fails. -
TaskEither<
L, R> -
TaskEither<L, R>
represents an asynchronous computation that either yields a value of typeR
or fails yielding an error of typeL
. -
TaskOption<
R> -
TaskOption<R>
represents an asynchronous computation that may fails yielding a None or returns aSome(R)
when successful. - Unit
-
Used instead of
void
as a return statement for a function when no value is to be returned.
Mixins
-
Alt<
KT, A> -
Alt
type class identifies an associative operation on a type constructor. -
Alt2<
KT, A, B> -
Alt3<
KT, P1, P2, P3> -
Applicative<
G, A> -
Applicative2<
G, A, B> -
Applicative3<
G, A, B, C> -
Band<
T> -
Bands are semigroups whose operation
(i.e.
combine
) is also idempotent (an operation that can be applied multiple times without changing the result beyond the initial application). -
BlocStreamListenableMixin<
S> -
BoundedSemilattice<
T> - A semilattice in which:
-
CommutativeGroup<
T> - An commutative group (also known as an abelian group) is a group whose combine operation is commutative.
-
CommutativeMonoid<
T> -
CommutativeMonoid
represents a commutative monoid. -
CommutativeSemigroup<
T> -
CommutativeSemigroup
represents a commutative semigroup. - DisposableStreamListenableMixin
-
Extend<
KT, A> -
Extend2<
KT, A, B> -
Filterable<
KT, A> -
Foldable<
G, A> -
Foldable2<
G, A, B> -
Functor<
G, A> -
Functor<G, A> extends HKT<G, A>
to express the fact that the classes implementing the Functor interface will need to be higher kinded types. -
Functor2<
G, A, B> -
Functor3<
G, A, B, C> -
Group<
T> - A group is a monoid where each element has an inverse.
-
Monad<
KT, A> -
Monad2<
KT, A, B> -
Monad3<
KT, P1, P2, P3> -
Monoid<
T> -
A monoid is a semigroup with an identity (
empty
). -
Semigroup<
T> -
A semigroup is any set
A
with an associative operation (combine
). -
Semilattice<
T> -
Semilattices
are commutative semigroups whose operation
(i.e.
combine
) is also idempotent.
Extensions
- CurryExtension2 on Output Function(Input1, Input2)
- Extract first parameter from this function to allow curring.
- CurryExtension3 on Output Function(Input1, Input2, Input3)
- CurryExtension4 on Output Function(Input1, Input2, Input3, Input4)
- CurryExtension5 on Output Function(Input1, Input2, Input3, Input4, Input5)
- FpdartOnDateTime on DateTime
-
fpdart
extension methods on DateTime -
FpdartOnIterable
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
fpdart
. -
FpdartOnIterableOfIterable
on Iterable<
Iterable< T> > -
Functional programming functions on
Iterable<Iterable<T>>
usingfpdart
. -
FpdartOnList
on List<
T> -
Functional programming functions on a mutable dart Iterable using
fpdart
. -
FpdartOnMap
on Map<
K, V> -
Functional programming functions on a mutable dart Map using
fpdart
. -
FpdartOnOption
on Option<
T> -
FpdartOnOptionMap
on Option<
Map< K, dynamic> > - FpdartOnPredicate on bool Function()
- FpdartOnPredicate1 on bool Function(P)
- FpdartOnString on String
-
Functional programming functions on dart String using
fpdart
. -
FpdartSequenceIterableEither
on Iterable<
Either< E, A> > -
FpdartSequenceIterableIO
on Iterable<
IO< T> > -
FpdartSequenceIterableIOEither
on Iterable<
IOEither< E, T> > -
FpdartSequenceIterableIOOption
on Iterable<
IOOption< T> > -
FpdartSequenceIterableOption
on Iterable<
Option< T> > -
FpdartSequenceIterableState
on Iterable<
State< S, A> > -
Convert a
List<State<S, A>>
to a singleState<S, List<A>>
. -
FpdartSequenceIterableTask
on Iterable<
Task< T> > -
FpdartSequenceIterableTaskEither
on Iterable<
TaskEither< E, T> > -
FpdartSequenceIterableTaskOption
on Iterable<
TaskOption< T> > -
FpdartTraversableIterable
on Iterable<
T> - FunctionalExtension on T
- UncurryExtension2 on Output Function(Input2) Function(Input1)
- UncurryExtension3 on Output Function(Input3) Function(Input2) Function(Input1)
- UncurryExtension4 on Output Function(Input4) Function(Input3) Function(Input2) Function(Input1)
- UncurryExtension5 on Output Function(Input5) Function(Input4) Function(Input3) Function(Input2) Function(Input1)
Constants
Properties
-
dateNow
→ IO<
DateTime> -
Constructs a DateTime instance with current date and time in the local time zone.
no setter
-
ioRefEq
→ Eq<
IORef< Object?> > -
Eq instance to compare IORefs using pointer equality
final
-
now
→ IO<
int> -
The number of milliseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
no setter
-
random
→ IO<
double> -
Generates a non-negative random floating point
value uniformly distributed in the range from 0.0, inclusive, to 1.0, exclusive.
no setter
-
randomBool
→ IO<
bool> -
Generates a random boolean value.
no setter
Functions
-
absent(
[Object? _, Object? __, Object? ___]) → FutureOr< void> -
boolAndMonoid(
) → Monoid< bool> -
boolOrMonoid(
) → Monoid< bool> -
constF<
T> (T value) → T Function([Object? _, Object? __, Object? ___]) -
constf a
is a unary function which evaluates toa
for all inputs. -
dualEndoMonoid<
A> () → Monoid< Endo< A> > -
endoMonoid<
A> () → Monoid< Endo< A> > -
identity<
T> (T a) → T -
Returns the given
a
. -
identityFuture<
T> (T a) → Future< T> -
Returns the given
a
, wrapped inFuture.value
. -
left<
L, R> (L l) → Either< L, R> -
Return a
Left(l)
. -
modifyIORef<
T> (Endo< T> update, IORef<T> ref) → IO<Unit> -
Works almost identical to the
write
method, but instead of taking a value that needs to be written, takes an Endo function, applies the IORef's current value to it and writes the result to the IORef. -
modifyIORefC<
T> (Endo< T> update) → IO<Unit> Function(IORef<T> ref) - A curried version of the modifyIORef
-
newIORef<
T> (T initial) → IO< IORef< T> > - Creates a new IORef inside an IO monad with a given initial value.
-
none<
T> () → Option< T> - Return a None.
-
option<
T> (T value, bool predicate(T)) → Option< T> -
Return Some of
value
whenpredicate
applied tovalue
returnstrue
, None otherwise. -
optionOf<
T> (T? t) → Option< T> -
Return None if
t
isnull
, Some otherwise. -
randomInt(
int min, int max) → IO< int> -
Generates a non-negative random integer uniformly distributed
in the range from
min
, inclusive, tomax
, exclusive. -
readIORef<
T> (IORef< T> ref) → IO<T> - Extracts a current value of the IORef and returns it inside the IO monad.
-
right<
L, R> (R r) → Either< L, R> -
Return a
Right(r)
. -
some<
T> (T t) → Option< T> -
Return a
Some(t)
. -
toBoolEither<
L> (String str, L onLeft()) → Either< L, bool> -
Convert this String to bool, returns the result of
onLeft
for invalid inputs. -
toBoolOption(
String str) → Option< bool> - Convert this String to bool, returns None for invalid inputs.
-
toDoubleEither<
L> (L onLeft()) → Either< L, double> Function(String) -
Convert this String to double, returns the result of
onLeft
for invalid inputs. -
toDoubleOption(
String str) → Option< double> - Convert this String to double, returns None for invalid inputs.
-
toIntEither<
L> (L onLeft()) → Either< L, int> Function(String) -
Convert this String to int, returns the result of
onLeft
for invalid inputs. -
toIntOption(
String str) → Option< int> - Convert this String to int, returns None for invalid inputs.
-
toNumEither<
L> (L onLeft()) → Either< L, num> Function(String) -
Convert this String to num, returns the result of
onLeft
for invalid inputs. -
toNumOption(
String str) → Option< num> - Convert this String to num, returns None for invalid inputs.
-
writeIORef<
T> (T value, IORef< T> ref) → IO<Unit> - Writes the given value to the IORef and returns a Unit inside the IO monad.
-
writeIORefC<
T> (T value) → IO< Unit> Function(IORef<T> ref) - A curried version of the writeIORef
Typedefs
-
Action<
T> = T Function() -
DataExtractor<
Response> = Object Function(Response response) -
Function which returns data (List or Map) from
Response
. -
DoAdapterEither<
L> = R Function< R>(Either< L, R> ) -
DoAdapterIO
= A Function<
A>(IO< A> ) -
DoAdapterIOEither<
E> = A Function< A>(IOEither< E, A> ) -
DoAdapterIOOption
= A Function<
A>(IOOption< A> ) -
DoAdapterOption
= A Function<
A>(Option< A> ) -
DoAdapterReaderTask<
E> = Future< A> Function<A>(ReaderTask< E, A> ) -
DoAdapterReaderTaskEither<
E, L> = Future< A> Function<A>(ReaderTaskEither< E, L, A> ) -
DoAdapterTask
= Future<
A> Function<A>(Task< A> ) -
DoAdapterTaskEither<
E> = Future< A> Function<A>(TaskEither< E, A> ) -
DoAdapterTaskOption
= Future<
A> Function<A>(TaskOption< A> ) -
DoFunctionEither<
L, R> = R Function(DoAdapterEither< L> $) -
DoFunctionIO<
A> = A Function(DoAdapterIO $) -
DoFunctionIOEither<
L, A> = A Function(DoAdapterIOEither< L> $) -
DoFunctionIOOption<
A> = A Function(DoAdapterIOOption $) -
DoFunctionOption<
A> = A Function(DoAdapterOption $) -
DoFunctionReaderTask<
E, A> = Future< A> Function(DoAdapterReaderTask<E> $) -
DoFunctionReaderTaskEither<
E, L, A> = Future< A> Function(DoAdapterReaderTaskEither<E, L> $) -
DoFunctionTask<
A> = Future< A> Function(DoAdapterTask $) -
DoFunctionTaskEither<
L, A> = Future< A> Function(DoAdapterTaskEither<L> $) -
DoFunctionTaskOption<
A> = Future< A> Function(DoAdapterTaskOption $) -
Endo<
A> = A Function(A a) -
ErrorCatcher<
Failure> = Failure Function(Object error, StackTrace stackTrace) -
Function which handles catched
error
andstackTrace
. -
FailureParser<
Failure, Response> = Failure? Function(Response response) -
Function which parses
Failure
fromResponse
if any. -
FutureAction<
T> = Future< T> Function() -
FutureArgAction<
T, Q> = Future< T> Function(Q data) -
FutureValueChanged<
T> = Future< void> Function(T value) -
FutureVoidAction
= Future<
void> Function() -
IdExtractor<
Item> = Object Function(Item item) - Typedef for a method which takes an item an returns it's uniq identifier.
-
Json
= Map<
String, dynamic> -
JsonMapper<
Data> = Data Function(Map< String, dynamic> json) -
Typedef for
json
toData
parser. -
Mapper<
T, Q> = T Function(Q data) -
ReactiveFacadeConsumerCubit<
T> = FacadeConsumerCubit< T> -
RequestAction<
Response> = Future< Response> Function() -
Typedef for api request which returns
Response
. -
Separated<
KT, A, B> = (HKT< KT, A> , HKT<KT, B> ) -
ValueActionChanged<
T> = void Function(T value) - VoidAction = void Function()