Skip to content

Commit b520a67

Browse files
committed
Add properties to impresion in impression listener
1 parent bae5f5d commit b520a67

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

splitio_platform_interface/lib/split_impression.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ class Impression {
77
final String? appliedRule;
88
final num? changeNumber;
99
final Map<String, dynamic> attributes;
10+
final Map<String, dynamic> properties;
1011

1112
Impression(this.key, this.bucketingKey, this.split, this.treatment, this.time,
12-
this.appliedRule, this.changeNumber, this.attributes);
13+
this.appliedRule, this.changeNumber, this.attributes, this.properties);
1314

1415
static Impression fromMap(Map<dynamic, dynamic> map) {
1516
return Impression(
@@ -20,11 +21,12 @@ class Impression {
2021
map['time'] as num?,
2122
map['appliedRule'] as String?,
2223
map['changeNumber'] as num?,
23-
Map<String, dynamic>.from(map['attributes'] as Map));
24+
Map<String, dynamic>.from(map['attributes'] as Map),
25+
Map<String, dynamic>.from(map['properties'] as Map));
2426
}
2527

2628
@override
2729
String toString() {
28-
return 'Impression = {"key":$key, "bucketingKey":$bucketingKey, "split":$split, "treatment":$treatment, "time":$time, "appliedRule": $appliedRule, "changeNumber":$changeNumber, "attributes":$attributes}';
30+
return 'Impression = {"key":$key, "bucketingKey":$bucketingKey, "split":$split, "treatment":$treatment, "time":$time, "appliedRule": $appliedRule, "changeNumber":$changeNumber, "attributes":$attributes, "properties":$properties}';
2931
}
3032
}

splitio_platform_interface/test/split_impression_test.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ void main() {
1212
'appliedRule': 'appliedRule',
1313
'changeNumber': 12512512,
1414
'attributes': {'good': true},
15+
'properties': {'bad': false, 'number': 10.5},
1516
};
1617

1718
Impression expectedImpression = Impression(
@@ -23,6 +24,7 @@ void main() {
2324
'appliedRule',
2425
12512512,
2526
{'good': true},
27+
{'bad': false, 'number': 10.5},
2628
);
2729

2830
Impression impression = Impression.fromMap(sourceMap);
@@ -34,5 +36,6 @@ void main() {
3436
expect(impression.appliedRule, expectedImpression.appliedRule);
3537
expect(impression.changeNumber, expectedImpression.changeNumber);
3638
expect(impression.attributes, expectedImpression.attributes);
39+
expect(impression.properties, expectedImpression.properties);
3740
});
3841
}

0 commit comments

Comments
 (0)