Skip to content

Commit cb75845

Browse files
committed
support extraData null value
1 parent de915c0 commit cb75845

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

packages/stream_feed/lib/src/core/models/enriched_activity.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class GenericEnrichedActivity<A, Ob, T, Or> extends Equatable {
6262
T Function(Object? json)? fromJsonT,
6363
Or Function(Object? json)? fromJsonOr,
6464
]) =>
65-
_$EnrichedActivityFromJson<A, Ob, T, Or>(
65+
_$GenericEnrichedActivityFromJson<A, Ob, T, Or>(
6666
Serializer.moveKeysToRoot(json, topLevelFields)!,
6767
fromJsonA ??
6868
(jsonA) => (A == User)
@@ -176,7 +176,7 @@ class GenericEnrichedActivity<A, Ob, T, Or> extends Equatable {
176176

177177
/// Map of custom user extraData
178178
@JsonKey(includeIfNull: false)
179-
final Map<String, Object>? extraData;
179+
final Map<String, Object?>? extraData;
180180

181181
GenericEnrichedActivity<A, Ob, T, Or> copyWith({
182182
A? actor,
@@ -263,6 +263,6 @@ class GenericEnrichedActivity<A, Ob, T, Or> extends Equatable {
263263
Object? Function(Or value) toJsonOr,
264264
) =>
265265
Serializer.moveKeysToMapInPlace(
266-
_$EnrichedActivityToJson(this, toJsonA, toJsonOb, toJsonT, toJsonOr),
266+
_$GenericEnrichedActivityToJson(this, toJsonA, toJsonOb, toJsonT, toJsonOr),
267267
topLevelFields);
268268
}

packages/stream_feed/lib/src/core/models/enriched_activity.g.dart

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/stream_feed/test/fixtures/enriched_activity.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,5 @@
8282
}
8383
]
8484
},
85-
"test": "test"
85+
"test": null
8686
}

packages/stream_feed/test/models_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ void main() {
245245
extraContext: const {'test': 'test'},
246246
origin: 'test',
247247
score: 1,
248-
extraData: const {'test': 'test'},
248+
extraData: const {'test': null},
249249
reactionCounts: const {'test': 1},
250250
ownReactions: {
251251
'test': [reaction1]
@@ -264,7 +264,7 @@ void main() {
264264
//that's why it's not explicit in the json fixture
265265
// all the extra data other than the default fields in json will ultimately
266266
// gets collected as a field extra_data of type Map
267-
expect(enrichedActivityFromJson.extraData, {'test': 'test'});
267+
expect(enrichedActivityFromJson.extraData, {'test': null});
268268
});
269269

270270
test('EnrichedActivity with CollectionEntry object', () {

0 commit comments

Comments
 (0)