CustomAdModel class
Represents an enterprise-grade custom/house ad item for offline fallback or direct campaigns.
Designed to comply with Google AdMob & Google Play Better Ads Policies:
- Prominent "AD" attribution
- Clear call-to-action
- Transparent advertiser attribution
Constructors
-
CustomAdModel({required String title, required String description, String? id, String? imageUrl, String? link, String callToAction = 'Learn More', String advertiser = 'Sponsored', double? rating = 4.9, VoidCallback? onTap, Map<
String, dynamic> ? extras}) -
const
-
CustomAdModel.fromJson(Map<
String, dynamic> json) -
Factory constructor to parse from JSON map.
factory
Properties
- advertiser → String
-
Advertiser title or brand label (default: "Sponsored").
final
- callToAction → String
-
Call-to-action button text (default: "Learn More").
final
- description → String
-
Ad description or promotional text.
final
-
extras
→ Map<
String, dynamic> ? -
Optional custom parameters for analytics or routing.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String?
-
Unique identifier for analytics and impression tracking.
final
- imageUrl → String?
-
Asset image path (e.g. "assets/images/promo.png") or network image URL.
final
- link → String?
-
Destination link, deep link, or website URL when clicked.
final
- onTap → VoidCallback?
-
Custom tap callback invoked when user clicks the ad.
final
- rating → double?
-
Optional star rating (e.g. 4.9).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- title → String
-
Ad title or headline (e.g. "Upgrade to Pro Version").
final
Methods
-
copyWith(
{String? id, String? title, String? description, String? imageUrl, String? link, String? callToAction, String? advertiser, double? rating, VoidCallback? onTap, Map< String, dynamic> ? extras}) → CustomAdModel - Creates a copy of this CustomAdModel with updated fields.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this model to a serializable JSON map.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited