leancode_contracts library

Classes

Binary
Stores binary data as a base64 encoded string.
Command
Command carrying data related to performing a certain action on the backend.
CommandFailure
Class which represents a result of unsuccesful command execution.
CommandResult
Result class for CQRS command result. Can be either CommandSuccess or CommandFailure.
CommandSuccess
Class which represents a result of succesful command execution.
ContractsSerializable
A JsonSerializable annotation with preset configuration. Only a subset of options can be changed, rest is set to adhere to contracts serialization.
Cqrs
Class used for communicating with the backend via queries and commands.
CqrsMethod
An interface for contracts that can be serialized and sent to the backend.
CqrsMiddleware
Abstract class for CQRS result handlers. Can be used to specify certain behaviors that will be triggered for given errors i.e. showing snackbar on network error or logging out on authetication error etc.
DateOnly
Represents a single day.
DateTimeOffset
A DateTime with a fixed offset
DurationJsonConverter
Converter for converting between C#'s System.TimeSpan and Dart's Duration
Equatable
A base class to facilitate operator == and hashCode overrides.
EquatableConfig
The default configurion for all Equatable instances.
JsonConverter<T, S>
Implement this class to provide custom converters for a specific Type.
JsonEnum
Allows configuration of how enum elements are treated as JSON.
JsonKey
An annotation used to specify how a field is serialized.
JsonLiteral
An annotation used to generate a private field containing the contents of a JSON file.
JsonSerializable
An annotation used to specify a class to generate code for.
JsonValue
An annotation used to specify how a enum value is serialized.
Operation<T>
Operation describing a criteria for a query, a command, and the results it returns.
OperationFailure<T>
Generic class which represents a result of unsuccesful operation execution.
OperationResult<T>
Generic result for CQRS operation result. Can be either OperationSuccess or OperationFailure.
OperationSuccess<T>
Generic class which represents a result of succesful operation execution.
Query<T>
Query describing a criteria for a query and the results it returns.
QueryFailure<T>
Generic class which represents a result of unsuccesful query execution.
QueryResult<T>
Generic result for CQRS query result. Can be either QuerySuccess or QueryFailure.
QuerySuccess<T>
Generic class which represents a result of succesful query execution.
TimeOnly
Represents a time of day, as would be read from a clock, within the range 00:00:00 to 23:59:59.999999.
ValidationError
A validation error.

Enums

CommandError
Error types of command failure.
FieldRename
Values for the automatic field renaming behavior for JsonSerializable.
OperationError
Error types of operation failure.
QueryError
Error types of query failure.

Mixins

EquatableMixin
A mixin that helps implement equality without needing to explicitly override operator == and hashCode.

Functions

$checkedConvert<T>(Map map, String key, T castFunc(dynamic), {Object? readValue(Map, String)?}) → T
Helper function used in generated code when JsonSerializableGenerator.checked is true.
$checkedCreate<T>(String className, Map map, T constructor(S <S>(String, S (Object?), {Object? readValue(Map, String)?})), {Map<String, String> fieldKeyMap = const {}}) → T
Helper function used in generated code when JsonSerializableGenerator.checked is true.
$checkedNew<T>(String className, Map map, T constructor(), {Map<String, String>? fieldKeyMap}) → T
Helper function used in generated code when JsonSerializableGenerator.checked is true.
$checkKeys(Map map, {List<String>? allowedKeys, List<String>? requiredKeys, List<String>? disallowNullValues}) → void
Helper function used in generated fromJson code when JsonSerializable.disallowUnrecognizedKeys is true for an annotated type or JsonKey.required is true for any annotated fields.
$enumDecode<K extends Enum, V>(Map<K, V> enumValues, Object? source, {K? unknownValue}) → K
Returns the key associated with value source from enumValues, if one exists.
$enumDecodeNullable<K extends Enum, V>(Map<K, V> enumValues, Object? source, {Enum? unknownValue}) → K?
Returns the key associated with value source from enumValues, if one exists.

Exceptions / Errors

BadKeyException
A base class for exceptions thrown when decoding JSON.
CheckedFromJsonException
Exception thrown if there is a runtime exception in fromJson code generated when JsonSerializableGenerator.checked is true
DisallowedNullValueException
Exception thrown if there are keys with disallowed null values in a JSON map that was provided during deserialization.
MissingRequiredKeysException
Exception thrown if there are missing required keys in a JSON map that was provided during deserialization.
UnrecognizedKeysException
Exception thrown if there are unrecognized keys in a JSON map that was provided during deserialization.