event_db library

See GenericModel and DatabaseRepository for starting points

Classes

BaseModel
Contains the minimum requirements to be considered a model
DatabaseRepository
Represents a class that implements some specific implementation of an interface with storage. Classes that implement this must retain data that is saved using the various functions such as saveModel and be retrieved using findModel in a separate session.
FakeDatabaseRepository
A DatabaseRepository that stores everything in memory
GenericModel
Base Class to be extended by
GenericModelMap<T extends BaseModel>
Represents a map of GenericModels with functions to automatically retrieve and save them in a DatabaseRepository
ListMovement<T extends OrdereableModel>
Records a movement of an OrdereableModel.
ListSizeValidator
Ensures that a list has a number of elements within a specific range.
ListSubValidator
Runs a Validator on each element in a given list.
MappableModel
Indicates that the BaseModel has a MappableFields object that MUST be implemented and can then be used to map the fields in this object into a Map
NumRangeValidator
Validates that a value falls within a certain range. Will return true if the value is not present.
PastDateTimeValidator
Ensures that a DateTime in name is in the past.
RequiredValidator
Ensures that a name is present in the map.
SpecificDatabase
Wraps a DatabaseRepository with all of the databaseFunctions having a given databaseName automatically passed as the database argument.
Validator
Used to ensure that a BaseModel.toMap meets specific parameters.
ValidatorCollection
Runs a group of Validators

Mixins

OrdereableModel
A GenericModel that has an ordinal parameter. When used with a ReorderableMap, by default greater ordinal values should be shown first.

Extensions

BaseModelFieldExtension on BaseModel
Adds methods to BaseModel to help with performing operations on the fields
BaseModelIDExtension on BaseModel
Provides convenience functions for interacting with the id and type of a BaseModel
JsonMap on Map<String, dynamic>
Extension on Map to make it easier to use as a json map.
JsonStringModel on BaseModel
Adds toJsonString and loadFromJsonString methods to simplify working with encoded json maps.
MapFieldsExtension on MappableFields
Adds the createMap and loadMap functions to conveniently perform the actions of MappableFields
ReorderableMap on GenericModelMap<T>
Adds functions to GenericModelMap specifically for OrdereableModel
ValidatorCommons on Validator
Adds common functions for Validators

Typedefs

Getter<T> = T Function()
Getter function to retrieve a field from a BaseModel
MappableFields = Map<String, Tuple2<Getter, Setter>>
Maps fields to their appropriate field key given/to a map
ModelConstructor<T extends BaseModel> = T Function()
Represents a constructor specifically for BaseModel
Setter<T> = void Function(T value)
Setter function to set a field in a BaseModel

Exceptions / Errors

DatabaseException
ValidationCollectionException
Exception thrown by ValidatorCollection when any of its Validators throw an exception. All the exceptions thrown can be seen here.
ValidationException
The exception thrown when a Validator fails.