HasAttributes<T> mixin

Mixin applications

Properties

appends Map<String, dynamic>
The accessors to append to the model's array form.
no setter
attributes Map<String, dynamic>
Get all of the current attributes on the model.
no setter
casts Map<String, dynamic>
The attributes that should be cast to native types.
no setter
fillable List<String>
The attributes that are mass assignable.
no setter
guarded List<String>
The attributes that aren't mass assignable.
no setter
hashCode int
The hash code for this object.
no setterinherited
hidden List<String>
The attributes that should be hidden for serialization.
no setter
original Map<String, dynamic>
Get the original attributes.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
visible List<String>
The attributes that should be visible in serialization.
no setter

Methods

append(List<String> attributes) → void
Append attributes.
castAttribute(String key, dynamic value) → dynamic
Cast an attribute to its declared Dart type.
except(List<String> keys) Map<String, dynamic>
Get all attributes except the given keys.
fill(Map<String, dynamic> attributes) → T
Fill the model with an array of attributes.
forceFill(Map<String, dynamic> attributes) → T
Force fill the model with an array of attributes.
fromJson(Map<String, dynamic> json) → void
Initialize from database record
getAttribute(String key) → dynamic
Get an attribute from the model.
getDirty() Map<String, dynamic>
Get the attributes that have been changed since the last sync.
getOriginal(String key, [dynamic defaultValue]) → dynamic
Get an original attribute value.
getRawAttribute(String key, [dynamic defaultValue]) → dynamic
Get a raw attribute without casting.
hasAttribute(String key) bool
Check if the model has a specific attribute.
hasCast(String key) bool
Determine if an attribute has a cast.
hasOriginal(String key) bool
Check if the model has a specific original attribute.
isClean([dynamic attributes]) bool
Check if the model or specific attribute is clean.
isDirty([dynamic attributes]) bool
Check if the model or specific attribute is dirty.
isFillable(String key) bool
Determine if the given attribute may be mass assigned.
makeHidden(List<String> attributes) → void
Make attributes hidden.
makeVisible(List<String> attributes) → void
Make attributes visible.
mergeAttributes(Map<String, dynamic> attributes) → void
Merge new attributes into the model.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
only(List<String> keys) Map<String, dynamic>
Get a subset of attributes.
setAttribute(String key, dynamic value) → void
Set a given attribute on the model.
setRawAttribute(String key, dynamic value) → void
Set a raw attribute without casting.
syncOriginal() → void
Sync the original attributes with the current.
toDatabaseMap() Map<String, dynamic>
Prepare the model for database insertion/update.
toJson() Map<String, dynamic>
Convert the model instance to JSON.
toJsonAsync() Future<Map<String, dynamic>>
toMap() Map<String, dynamic>
Convert the model instance to a map.
toMapAsync() Future<Map<String, dynamic>>
Convert the model instance to a map, resolving any Future values.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited