AttributeBuilder class final
A fluent builder for creating attribute maps with automatic type conversion.
AttributeBuilder provides a convenient way to build maps of AttributeValue objects from native Dart types. It automatically converts String, int, double, and bool values to their corresponding AttributeValue types.
Example:
final attributes = AttributeBuilder()
.add('user_id', 'abc123') // Becomes StringAttr
.add('age', 25) // Becomes IntAttr
.add('score', 95.5) // Becomes DoubleAttr
.add('is_premium', true) // Becomes BooleanAttr
.build();
Measure.instance.trackEvent(
name: 'user_profile_updated',
attributes: attributes,
);
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
-
add(
String key, Object value) → AttributeBuilder - Adds a key-value pair to the attributes map.
-
build(
) → Map< String, AttributeValue> - Builds and returns the final attributes map.
-
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