PropertyValues class abstract
Interface for accessing a collection of PropertyValue objects.
This interface provides a uniform way to access property values regardless of the underlying storage implementation. It extends Iterable to allow easy iteration over all property values.
Example usage:
class MyProps extends PropertyValues {
final list = [PropertyValue('key', 'value')];
@override
List<PropertyValue> getPropertyValues() => list;
@override
PropertyValue? getPropertyValue(String name) =>
list.firstWhereOrNull((pv) => pv.name == name);
@override
PropertyValues changesSince(PropertyValues old) => this;
@override
bool containsProperty(String propertyName) =>
getPropertyValue(propertyName) != null;
@override
bool get isEmpty => list.isEmpty;
@override
Iterator<PropertyValue> get iterator => list.iterator;
}
- Inheritance
-
- Object
- Iterable<
PropertyValue> - PropertyValues
- Implementers
Constructors
Properties
- first → PropertyValue
-
The first element.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether the collection has no properties.
no setteroverride
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
-
iterator
→ Iterator<
PropertyValue> -
A new
Iteratorthat allows iterating the elements of thisIterable.no setterinherited - last → PropertyValue
-
The last element.
no setterinherited
- length → int
-
The number of elements in this Iterable.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → PropertyValue
-
Checks that this iterable has only one element, and returns that element.
no setterinherited
Methods
-
any(
bool test(PropertyValue element)) → bool -
Checks whether any element of this iterable satisfies
test.inherited -
cast<
R> () → Iterable< R> -
A view of this iterable as an iterable of
Rinstances.inherited -
changesSince(
PropertyValues old) → PropertyValues -
Computes the set of properties that differ compared to another
oldPropertyValues. -
contains(
Object? value) → bool -
Returns
trueif a property with the givenvalueexists.override -
containsProperty(
String propertyName) → bool -
Returns
trueif a property with the givenpropertyNameexists. -
elementAt(
int index) → PropertyValue -
Returns the
indexth element.inherited -
every(
bool test(PropertyValue element)) → bool -
Checks whether every element of this iterable satisfies
test.inherited -
expand<
T> (Iterable< T> toElements(PropertyValue element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
firstWhere(
bool test(PropertyValue element), {PropertyValue orElse()?}) → PropertyValue -
The first element that satisfies the given predicate
test.inherited -
fold<
T> (T initialValue, T combine(T previousValue, PropertyValue element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable< PropertyValue> other) → Iterable<PropertyValue> -
Creates the lazy concatenation of this iterable and
other.inherited -
forEach(
void action(PropertyValue element)) → void -
Invokes
actionon each element of this iterable in iteration order.inherited -
getPropertyValue(
String propertyName) → PropertyValue? -
Retrieves a property by its
propertyName, ornullif not found. -
getPropertyValues(
) → List< PropertyValue> - Returns all property values as an unmodifiable list.
-
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
inherited
-
lastWhere(
bool test(PropertyValue element), {PropertyValue orElse()?}) → PropertyValue -
The last element that satisfies the given predicate
test.inherited -
map<
T> (T toElement(PropertyValue e)) → Iterable< T> -
The current elements of this iterable modified by
toElement.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reduce(
PropertyValue combine(PropertyValue value, PropertyValue element)) → PropertyValue -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
singleWhere(
bool test(PropertyValue element), {PropertyValue orElse()?}) → PropertyValue -
The single element that satisfies
test.inherited -
skip(
int count) → Iterable< PropertyValue> -
Creates an Iterable that provides all but the first
countelements.inherited -
skipWhile(
bool test(PropertyValue element)) → Iterable< PropertyValue> -
Creates an
Iterablethat skips leading elements whiletestis satisfied.inherited -
take(
int count) → Iterable< PropertyValue> -
Creates a lazy iterable of the
countfirst elements of this iterable.inherited -
takeWhile(
bool test(PropertyValue element)) → Iterable< PropertyValue> -
Creates a lazy iterable of the leading elements satisfying
test.inherited -
toList(
{bool growable = true}) → List< PropertyValue> -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< PropertyValue> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
Returns a string representation of (some of) the elements of
this.inherited -
where(
bool test(PropertyValue element)) → Iterable< PropertyValue> -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test.inherited -
whereType<
T> () → Iterable< R> -
Creates a new lazy Iterable with all elements that have type
T.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited