dogs_core library

Classes

AnnotationMessage
A single message produced by a validator.
AnnotationResult
Container for validation results.
APISchemaObjectMetaVisitor
Visitor for APISchemaObject instances. Can be applied to structure annotations to additionally supply meta information.
CascadeItemType<T>
Defines the item type of the implementing class. The getItemType method in lyell_gen will consider T as the actual item type and treat it as if it is the type argument of a List, Future or a similar generic core types.
ClassValidator
Class level validator for annotations of ClassValidators.
CodecPrimitiveCoercion
Mechanism for coercing specific native types to other native types.
ComposableOperationModeFactory<T extends OperationMode>
A OperationModeFactory that composes multiple other factories.
ConverterSupplyingVisitor
Annotation to override the converter used for a field.
DateTimeConverter
DogConverter for DateTime instances which encodes the timestamp as a Iso8601 string.
DefaultNativeCodec
Default implementation of DogNativeCodec. Defines the following native types:
DefaultStructureConverter<T>
Default DogConverter base for DogStructures. Normally extended by generated converters.
DefaultTreeBaseFactories
Collection of default TreeBaseConverterFactorys.
DelegateQualifiedTypeTree<T, B>
DogBool
Graph node representing a boolean value.
DogConverter<T>
Base class for converters used by the DogEngine. Contains structure information about the type being serialized and provides an OperationMode mapping for all supported operation modes.
DogDouble
Graph node representing a double value.
DogEngine
Registry and interface for everything related to dogs.
DogGraphValue
Graph node of the serialized DOG graph.
DogInt
Graph node representing an integer value.
DogList
Graph node representing a list value.
DogMap
Graph node representing a map value.
DogNative
Wrapped native value.
DogNativeCodec
Defines the native object types for a DogEngine and provides converters for them.
DogNull
Graph node representing a null value.
DogSchema
Provides the ability to generate openapi schema objects for all registered structures.
DogString
Graph node representing a string value.
DogStructure<T>
Defines the structure of class T and provides methods for instance creation and data lookups. Also contains runtime instances of RetainedAnnotations used in T.
DogStructureConverterImpl<T>
Mock implementation for DefaultStructureConverter.
DogStructureField
The definition of a field in a DogStructure. Holds all necessary information to validate and serialize and introspect the field.
DogStructureProxy
Method proxy provider for DogStructures. A structure proxy must provided instantiation/"activation" for the object and property accessor methods for all fields defined by the structure. A get-all method for faster field value retrieval must also be provided.
DogVisitor<T>
Visitor for DogGraphValues that maps a value to type T.
DurationConverter
DogConverter for Duration instances which encode a duration as a Iso8601 string.
ExpandedDogVisitor<T>
A visitor for DogGraphValues that provides a visitor method for each type of value.
FieldValidator
Property level validator for annotations of DogStructureFields.
GeneratedEnumDogConverter<T extends Enum>
A DogConverter that allows for the conversion of enum values to and from strings.
ItemAssociatedTypeToken<SOURCE, ITEM>
Double type capture token for associated item types. Mainly useful for serialization or type mapping.
IterableTreeNativeOperation
The native operation implementation for IterableTreeBaseConverterMixin.
LightweightMigration
LightweightMigration is a class that extends SerializationHook. It provides a lightweight way to handle migrations by executing a list of migration functions before deserialization.
LinkSerializer
MapNTreeArgConverter<K, V>
NTreeArgConverter for Maps.
MemoryDogStructureProxy
Simple class-less implementation of DogStructureProxy, primarily for tests.
NativeRetentionConverter<T>
Converter that just keeps the value as is.
NativeSerializerMode<T>
Operation mode that converters a value to a native representation as defined by the DogNativeCodec of the current DogEngine. For most implementations, this means converting the value to a "primitive" dart type, that could also be encoded using jsonEncode.
NoCodecPrimitiveCoercion
Default implementation of CodecPrimitiveCoercion that throws an error when coercion is attempted.
NTreeArgConverter<BASE>
A converter interface for a generic type with a fixed number of type arguments. Used together with TreeBaseConverterFactory.createNargsFactory to create a DogConverter for generic types.
ObjectFactoryStructureProxy<T>
DogStructureProxy implementation for creating universal object factories.
OperationMode<T>
An operation mode exposed by a DogConverter.
OperationModeCacheEntry<T extends OperationMode>
A cache entry for OperationModes. Holds all resolved OperationModes for the specified OperationModeCacheEntry.modeType.
OperationModeFactory<T extends OperationMode>
Factory for OperationModes.
OperationModeRegistry
The registry for OperationModes. Serves as the central point for resolving OperationModes for DogConverters and Types. Also functions as a cache for the resolved OperationModes.
Optional<T>
Port of Java's Optional (https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html)
OptionalNTreeArgConverter<T>
NTreeArgConverter for Optionals.
Page<T>
Collection that represents a page of results.
PageMeta
Metadata about a page.
PageNTreeArgConverter<T>
A NTreeArgConverter for Pages.
PageRequest
Simple page and size based pagination request.
PageRequestConverter
A DogConverter for PageRequests.
PolymorphicConverter
DogConverter that supports polymorphic serialization and deserialization. Supports a maximum of one level of polymorphism because of the lack of runtime type introspection available in Dart.
PostRebuildHook<T>
Hook that runs after a structure T has been rebuilt.
Projections
A collection of projection transformers.
PropertyName
Overrides the name that will be used by the GeneratedDogConverter for this specific property. By default, the field name will be used.
PropertySerializer
Overrides the serializer that will be used by the GeneratedDogConverter for this specific property. By default, the field will be serialized using the convert associated with its type.
QualifiedTerminal<T>
QualifiedTypeTree<T, B>
QualifiedTypeTreeN<T, B>
RegExpConverter
DogConverter for RegExp instances which encodes the regular expression as a string.
RetainedAnnotation
Marker annotation to make an annotation accessible at runtime using RetainedAnnotationHolder implementations.
RetainedAnnotationContainer
Standard implementation of const RetainedAnnotationHolder.
RetainedAnnotationHolder
Abstract container of RetainedAnnotations.
RevisionMigration
RevisionMigration is a class that extends SerializationHook. It provides a way to handle migrations by executing a list of migration functions before deserialization and after serialization.
Serializable
See @serializable.
SerializableLibrary
Marks a library import as dogs serializable.
SerializationHook
SerializationHook is an abstract class that implements StructureMetadata. It provides two methods for handling serialization and deserialization events.
SimpleDogConverter<T>
Simple converter base that only requires a serialize and deserialize method. Automatically adds NativeSerializerMode as well as a synthetic DogStructure with the given SimpleDogConverter.serialName.
SingletonConverterOperationModeFactory<T extends OperationMode>
A OperationModeFactory that returns a single OperationMode for a DogConverter of type.
SingletonTypeOperationModeFactory<T extends OperationMode>
A OperationModeFactory that returns a singleton OperationMode for a specific type.
StructureHarbinger<T>
Utility class for resolving converters for a DogStructure.
StructureMetadata
Marks a annotation as a structure annotation and retainable.
StructureNativeSerialization<T>
A NativeSerializerMode that supplies native serialization for DogStructures.
StructureNode
Superclass for all structure related subtypes.
StructureOperationModeFactory<MODE_TYPE extends OperationMode>
Static way to provide additional opmode factories to the default structure converter.
StructureValidation<T>
A ValidationMode that provides validation for DogStructures.
TokenTypeTrees
TreeBaseConverterFactory
A factory for DogConverters that are derived from a TypeTree.
TypeCapture<T>
Abstract base class for using a generic type capture.
TypeContainer0
TypeContainer1<A>
TypeContainer2<A, B>
TypeContainer3<A, B, C>
TypeContainer4<A, B, C, D>
TypeContainer5<A, B, C, D, E>
TypeContainer6<A, B, C, D, E, F>
TypeContainer7<A, B, C, D, E, F, G>
TypeContainers
TypeToken<T>
Default implementation for a TypeCapture of type T.
TypeTree<BASE>
TypeTree0<T>
TypeTree1<BASE, ITEM>
TypeTree2<BASE, ITEM0, ITEM1>
TypeTree3<BASE, ITEM0, ITEM1, ITEM2>
TypeTreeN<BASE>
Uint8ListConverter
DogConverter for Uint8List instances which encodes the binary data as a base64 string using base64Encode.
UriConverter
DogConverter for Uri instances which encodes the uri into a string.
ValidationMode<T>
Operation mode that provides a way to validate objects and return validation related error messages as annotations.

Enums

IterableKind
Common iterable kinds which are compatible with dogs.
StructureConformity
The conformity of a structure.

Mixins

Dataclass<T>
A mixin that provides dataclass functionality to a class, including validation shortcuts, equality, hashcode and toString
EnumConverter<T extends Enum>
Mixin that exposes a public api surface for enum converters. Primarily intended to be used by opmode factories for converter tree introspection.
ExpandedGraphDogVisitorMixin<T>
A mixin that provides a default implementation for ExpandedDogVisitor. Override the methods to provide custom behavior for each type of value.
IterableTreeBaseConverterMixin
A mixin for DogConverters that handle iterable types.
MetadataMixin
A mixin that provides a simple way to add metadata to a class.
OperationMapMixin<T>
Provides a more convenient way to resolve OperationModes for DogConverters.
TypeCaptureMixin<T>
Mixin for adding the TypeCapture interface to classes.

Extensions

DogEngineShortcuts on DogEngine
Extensions which provide easier shortcuts for common operations.
DogJsonExtension on DogEngine
Extension on DogEngine that provides JSON serialization and deserialization.
DogsIterableExtension on Iterable<T>
Extensions on Iterables.
DogValueExtension on DogGraphValue
Extensions on DogGraphValues.
FieldExtension on DogStructureField
Extensions on DogStructureFields.
ProjectionExtension on DogEngine
Extensions on the DogEngine related to projections.
QualifiedExtension on TypeTree
StructureExtensions on DogStructure
Extensions on DogStructures.
TypeTreeExtension on TypeTree<T>

Constants

beanIgnore → const _BeanIgnore
Marks a property as ignored when using the bean conformity.
deepEquality → const DeepCollectionEquality
Static DeepCollectionEquality instance used by the dog library.
linkSerializer → const LinkSerializer
Manually marks a custom dog converter implementation for linking. The dogs_generator will then include an instance of this converter.
polymorphic → const _Polymorphic
Marks a property as polymorphic, meaning its value's type can vary.
serializable → const Serializable
Marks a class or enum as serializable. The dogs_generator will then generate a DefaultStructureConverter which also implements Copyable and Validatable. The generator will also generate an implementation of Builder for the given type with the suffix 'Builder' appended to the original class name. Annotated types must match following conditions:

Properties

dogs DogEngine
Static instance of DogEngine that will be initialised by invoking the generated initialiseDogs() method.
no setter
kCacheDataclassHashCodes bool
Changes if Dataclasses lazily cache their deep hashCode. Significantly speeds up high-volume comparisons between similar Dataclasses but increases memory overhead.
getter/setter pair
kDefaultPageSize int
The default page size used by PageRequests.
getter/setter pair
kWarnPolymorphicTerminalNode bool
Changes if polymorphic terminal nodes inferred for type trees print warnings on creation in debug mode.
getter/setter pair
structureOperationFactories Map<Type, StructureOperationModeFactory<OperationMode>>
Internal registry for StructureOperationModeFactorys.
getter/setter pair

Functions

adjustIterable<T>(dynamic value, IterableKind kind) → dynamic
Converts a value to the given IterableKind. If the value is a Iterable implementation, it will converted to the desired IterableKind. Trying to convert singular values to a iterable will result in an exception.
adjustWithCoercion(dynamic value, IterableKind kind, TypeCapture target, CodecPrimitiveCoercion coercion, String? fieldName) → dynamic
Converts a value to the given IterableKind. Tries to coerce the value to the desired type using the coercion if the value is not assignable to the target type.
compareTypeHashcodes(Type a, Type b) int
Compares two types by their hashcodes.
isPolymorphicField(DogStructureField field) bool
Checks if a field is marked as polymorphic.
mapifyValue(dynamic obj) Map
Makes sure that the given obj is a map by wrapping it in a map if necessary.
project<T>(Object value, [Object? a, Object? b, Object? c]) → T
Creates a projection resulting in an instance of T. All input fields are dynamic and contain following:
registerStructureOperationFactory(StructureOperationModeFactory<OperationMode> factory) → void
Register a StructureOperationModeFactory fallback for DogStructures. This method exists for legacy reasons and should not be used anymore, please instead use DogEngine.registerModeFactory with normal OperationModeFactorys.
stringKeyedMapFrom(Object? value) Object?
Deeply converts a map with dynamic keys to a map with string keys.
substituteNullValues(Object? value) Object?
Deeply converts a map with dynamic keys to a map with string keys.
unmapifyValue(Map obj) → dynamic
Undo the mapifyValue operation.
unsusbstituteNullValues(Object? value) Object?
Undoes the conversion of substituteNullValues.

Typedefs

EnumFromString<T> = T? Function(String)
Decodes a enum value from a string.
EnumToString<T> = String Function(T?)
Encodes a enum value to a string.
MigrationFunction = dynamic Function(Map<String, dynamic> map, DogStructure structure, DogEngine engine)
A function that may be used to transform a map before deserialization. May be used in conjunction with LightweightMigration or RevisionMigration.
ProjectionTransformer = Map<String, dynamic> Function(Map<String, dynamic> data)
Transformer that applies a projection to a Map document and returns the transformed document if a change was made.
TraverseResult = ({bool exists, dynamic value})
A result of traversing a map. exists is true if the path exists in the map. value is the value at the given path or null if it doesn't exist.

Exceptions / Errors

DogException
General exception for dogs related errors.
DogFieldSerializerException
Specific DogSerializerException thrown when a DogConverter fails to convert a field. Contains the DogStructureField that failed the conversion.
DogProjectionException
Exception thrown when the DogEngine fails to project a document.
DogSerializerException
Exception thrown when a DogConverter fails to convert a value.
ValidationException
An exception thrown when validation fails.