Skip to content

Commit d101471

Browse files
committed
refactor(entity_details): simplify entity loading logic
- Remove optional parameters and assertions in EntityDetailsLoadRequested event - Make entityId and contentType required fields - Remove deprecated entity parameter - Update props list to reflect changes
1 parent 1b870ee commit d101471

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

lib/entity_details/bloc/entity_details_event.dart

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,24 @@ abstract class EntityDetailsEvent extends Equatable {
1515
class EntityDetailsLoadRequested extends EntityDetailsEvent {
1616
const EntityDetailsLoadRequested({
1717
required this.adThemeStyle,
18-
this.entityId,
19-
this.contentType,
20-
this.entity,
18+
required this.entityId,
19+
required this.contentType,
2120
}) : assert(
22-
(entityId != null && contentType != null) || entity != null,
23-
'Either entityId/contentType or a full entity object must be provided.',
21+
entityId != null && contentType != null,
22+
'Both entityId and contentType must be provided.',
2423
);
2524

2625
/// The unique ID of the entity to load.
27-
final String? entityId;
26+
final String entityId;
2827

2928
/// The type of the entity to load.
30-
final ContentType? contentType;
31-
32-
/// The full entity object, if already available.
33-
final FeedItem? entity;
29+
final ContentType contentType;
3430

3531
/// The current ad theme style, required for ad injection.
3632
final AdThemeStyle adThemeStyle;
3733

3834
@override
39-
List<Object?> get props => [entityId, contentType, entity, adThemeStyle];
35+
List<Object?> get props => [entityId, contentType, adThemeStyle];
4036
}
4137

4238
/// Event to toggle the "follow" status of the currently loaded entity.

0 commit comments

Comments
 (0)