ItemClassWithAccessor class abstract
Flutter cannot use the dart mirroring packages, so the class used to store individual items in the list must have a prop accessor for any data that needs to be accessed dynamically.
This item class will generally also extend equatable.
class kItemClass extends Equatable implements ItemClassWithAccessor {
final String id;
final String name;
const kItemClass({
this.id,
this.name,
});
dynamic operator [](String prop) {
switch (prop) {
case 'id':
return id;
break;
case 'name':
return name;
break;
default:
throw ArgumentError(
'Property `$prop` does not exist on ItemClass.',
);
}
}
@override
List<Object> get props => [id, name];
}
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String prop) → dynamic -
Dynamic
prop
accessor.