Skip to content

Commit 037dcc6

Browse files
committed
feat(ads): introduce AdPlaceholder model
- Create a new StatelessWidget class AdPlaceholder - Implement EquatableMixin for state comparison - Add documentation explaining the purpose and usage of AdPlaceholder - Define a unique ID for each ad placeholder instance - Include this model in the ads library for feed item ad placeholders
1 parent 9ec434e commit 037dcc6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

lib/ads/models/ad_placeholder.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import 'package:core/core.dart';
2+
import 'package:equatable/equatable.dart';
3+
4+
/// {@template ad_placeholder}
5+
/// A stateless [FeedItem] that acts as a marker for an ad slot in the feed.
6+
///
7+
/// This model is used in the BLoC's state to indicate where an ad should be
8+
/// displayed, without holding the actual, stateful native ad object.
9+
/// The actual ad loading and display logic is handled by a dedicated widget
10+
/// that interacts with an ad cache.
11+
/// {@endtemplate}
12+
class AdPlaceholder extends FeedItem with EquatableMixin {
13+
/// {@macro ad_placeholder}
14+
const AdPlaceholder({required this.id}) : super(type: 'ad_placeholder');
15+
16+
/// A unique identifier for this specific ad placeholder instance.
17+
///
18+
/// This ID is used by the ad loading widget to request a specific ad
19+
/// from the ad cache or to load a new one if not found.
20+
final String id;
21+
22+
@override
23+
List<Object?> get props => [id, type];
24+
}

0 commit comments

Comments
 (0)