Objects class
The Schemake type matching a Dart Map, but providing a schema for its entries (similar to a class in languages like Dart and Java).
For example, an Objects type can be defined that matches only Maps that
have a key "name"
of type Strings.
It may define a strategy for dealing with other properties that are not
defined in the schema via UnknownPropertiesStrategy.
If UnknownPropertiesStrategy.ignore is used, unknown properties are simply
ignored (no error is raised, but values are discarded).
With UnknownPropertiesStrategy.keep, unknown properties are kept but their
types are not limited in any way (i.e. they are kept as is). This allows
defining semi-structured data structures where only some of the properties
have a known data type.
With UnknownPropertiesStrategy.forbid, no properties may appear which are
not defined by the Objects.properties. An error is raised if that happens.
This can be used for strictly ensuring the data structure matches the
expected schema.
Constructors
Properties
- description → String
-
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
finalinherited
-
properties
→ Map<
String, Property< Object?> > -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unknownPropertiesStrategy → UnknownPropertiesStrategy
-
finalinherited
Methods
-
bind(
Stream< Object?> stream) → Stream<Map< String, Object?> > -
Transforms the provided
stream
.inherited -
cast<
RS, RT> () → Converter< RS, RT> -
Provides a
Converter<RS, RT>
view of this stream transformer.inherited -
checkRequiredProperties(
Iterable< String> providedProperties) → void -
Check whether all required properties have been provided, raising a
MissingPropertyException if not.
inherited
-
convert(
Object? input) → Map< String, Object?> -
Converts
input
and returns the result of the conversion.override -
convertProperty<
V> (Converter< Object?, V> converter, String name, Map<Object?, Object?> map) → V -
Convert a property to its expected value.
inherited
-
convertPropertyOrDefault<
V> (Converter< Object?, V> converter, String name, Map<Object?, Object?> map, V defaultValue) → V -
Convert a property to its expected value or returns a default value
in case the property is not present.
inherited
-
convertToMap(
Object? input) → Map< String, Object?> -
Convert a value to Map, enforcing any restrictions imposed by this type.
inherited
-
dartType(
) → Type -
inherited
-
fuse<
TT> (Converter< Map< other) → Converter<String, Object?> , TT>Object?, TT> -
Fuses
this
withother
.inherited -
getPropertyConverter(
String property) → Converter< Object?, Object?> ? -
Get the Converter for the property of this object with the given name.
override
-
getRequiredProperties(
) → Iterable< String> -
Get all required (non-nullable properties without default values)
properties of this object.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
startChunkedConversion(
Sink< Map< sink) → Sink<String, Object?> >Object?> -
Starts a chunked conversion.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited