Schema class
Schemas provide getters and setters that help us transform responses into objects with their own attributes, relationships, related objects and errors.
Constructors
-
Schema([Map<
String, dynamic> ? attributes]) - Default constructor
- Schema.create(ResourceObject resourceObject)
- Create schema with attributes
Properties
-
attributes
→ Map<
String, dynamic> -
Retrieve raw attributes of model schema
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → dynamic
-
Retrieve id of schema
no setter
- isNew → bool
-
Check if id is assigned
no setter
- resourceObject ↔ ResourceObject
-
A wrap object from raw response
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
baseURL(
) → String? - Override baseURL for only model. Not for all.
-
deserializeMany(
dynamic data) → ResourceCollection - From data to Resource Collection
-
deserializeOne(
Map< String, dynamic> data) → ResourceObject - From data to Resource Object
-
getAttribute<
T> (String key) → T - Helper function to get attribute. Use dot notation in key to access nested keys.
-
hasMany<
T> (String relationshipPath, T createInstance(ResourceObject object)) → Iterable< T> - Load relation hasMap for Schema specified. Throws a StateError if relationshipPath not exists or is null.
-
hasManyOrNull<
T> (String relationshipPath, T createInstance(ResourceObject object)) → Iterable< T> ? - Load relation hasMap for Schema specified. Or returns null if relationshipPath not exists or is null.
-
hasOne<
T> (String relationshipPath, T createInstance(ResourceObject object)) → T - Load relation hasOne for Schema specified. Throws a StateError if relationshipPath not exists or is null.
-
hasOneOrNull<
T> (String relationshipPath, T createInstance(ResourceObject object)) → T? - Load relation hasOne for Schema specified. Or returns null if relationshipPath not exists or is null.
-
load<
T extends Schema> (T createInstance(ResourceObject resourceObject), {T? current}) → ApiQuery< T> - Lazy load relationships from model
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parameterNames(
) → QueryParameters - Get default parameterNames
-
primaryKey(
) → String - Retrieve key of primaryKey
-
resource(
) → String - Get model name or target endpoint route
-
setAttribute<
T> (String key, T value) → void - Helper function to set attribute. Use dot notation in key to access nested keys.
-
stringifyOptions(
) → StringifyOptions - Default stringifyOptions
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited