structures library

All commonly used standalone data structures and utility classes and extensions.

This library is a collection of data structures and utility classes and extensions that are commonly used in the development of applications.

The library is divided into the following sections:

Classes

AList<T extends Object>
AValue<T extends Object>
ALiveValue
Choice<T extends Named<T>>
ChoiceList
ChoiceTree<T extends Object>
SingleChoiceTree
DateEntry
Either<L, R>
The base class for Either monad.
Entry<T extends Object>
This value is meant to handle instances where the field value
Failure
A Failure Object class representing a failed validation

This Failure class is meant to express errors as domain objects as opposed to simple systems runtime object with cryptic failure messages and stacktrace.

This Object is sent to UI components as a validation response. As such, it is designed to carry meaningful straight-forward information.

The UI component that receive this are expected to do minimal to no transformation of the information contained in this object before displaying it to the user.

All efforts must be done to make the messages, simple clean and as business/user ready as possible.

The failure convention here is when the validation fails to give the error data Object that is the failure.

Note:
Field<T extends Entry<Object>>
Field
FormatRule
FieldFormatterData

This data class defines the properties every domain field formatter entity must have.

It holds immutable properties that make up the structure and meaning of a field formatter. Use this information to create an input formatter.
Left<L, R>
Represent the Left case of the Either monad, containing a value of type L.
Live
Live
LiveValue<T extends Object>
LiveValue
Model
Model
Named<T extends Named<T>>
Named model
Notifier
Notifier
Pair<T, S>
Pair is used to combine together two values that may be of different data types. Pair provides a way to store two heterogeneous objects as a single unit.
RealTime
A class that contains methods for getting the current time.

Represent the Right case of the Either monad, containing a value of type R.
TextEntry
ThemeModel
Theme entity model
UpdateThemeInput
Value<T extends Object>
Value

Enums

EntryVisibilityStatus
FailureType
This is the type of failure that occurred.

Corresponds to the failure severity.
FetchProgressStatus
FieldEnabledStatus
FieldVisibilityStatus
ThemeType
ValidationStatus
WeekDay
A WeekDay enum.

Contains the days of the week. In this enum, Sunday is the first day of the week. Sabbath is the seventh day of the week, which is Saturday.

Mixins

ModelFactory<T extends Model>
An Interface for simple serialization and converting of model objects to other forms of implementation that are just implementation detail. Allows us to transform model fromMap and toMap even when they are unknown at declaration time. While it's more alluring to have the fromMap and toMap adapters in the model it's self, its helpful to use this when type is unknown. Important also for models one doesn't control.

Extensions

AStringListExtension on List<String>
An extension on a List
BoolEvent on LiveValue<bool>
BoolValue on Value<bool>
Extensions on Value
IndexedIterableExtension on Iterable<T>
Adds functionality to iterable

map2 and map3 are the same as map but with the index given to you in the transformer
forEach2 and forEach3 are the same as forEach but with the index given to you in the transformer
IterableValue on Value<Iterable<T>>
LiveChoiceExtension on LiveValue<Choice<T>>
A Simple Choice Item extension on Value<Choice<I, T>>

This extension provides a simple way to access the properties of Choice without having to access the value property

This extension is only available for Value<Choice<I, T>>, and it's subtypes.
LiveIterableValue on LiveValue<List<T>>
LiveMapValue on LiveValue<Map<S, T>>
MakeLive on T
Makes it easy to turn any Object into a LiveValue or a Value
MapValue on Value<Map<S, T>>
PararellelMerge on Pair<List<T>, List<S>>
Merges two paired lists into a single list of M where M is the return of the provided Merger.
StringCaseExtension on String
Extension methods for the String class.
ValueChoiceExtension on Value<Choice<T>>
Whenable on Named<T>

Properties

deepEquals bool Function(Object? a, Object? b)
Deep equals that accounts for collection equality
final
generalLongDateFormat → DateFormat
The long-form date-format to use to display dates to the user. eg "Jan 19, 2021" Note this does not include the time or timezone information.
final
generalLongDateTimeFormat → DateFormat
The long-form date-format to use to display date-times to the user: eg "Jan 19, 2021 22:23:24" Note this does not include timezone information.
final
generalMediumDateTimeFormat → DateFormat
The medium-form date-format to use to display date-times to the user: eg "Jan 19, 2021 22:23" Note this does not include timezone information.
final

Typedefs

ItemIdFunction<I extends Object, T extends Object> = I Function(T)
ItemIdFunction is the method that generates the id for each choice, the id generated must be unique.

The ItemIdFunction is used to generate the id for each choice item

ValidationRule<T extends Entry<Object>> = String Function(Field<T> field, String value)
ValueConsumerCallback<T extends Object> = void Function(T value)
A ValueConsumerCallback callback
ValueObserverCallback<T extends Object> = void Function(T oldValue, T newValue)
A ValueObserverCallback callback
VoidCallback = void Function()
A VoidCallback

Exceptions / Errors

ObjectDisposedException
This exception object that get thrown when a value of a disposed object gets called