33 lines
775 B
Dart
33 lines
775 B
Dart
class BannerModel {
|
|
final int id;
|
|
|
|
final String documentUrl; // Added to store the full URL
|
|
final String createdDate;
|
|
|
|
BannerModel({
|
|
required this.id,
|
|
|
|
required this.documentUrl,
|
|
required this.createdDate,
|
|
});
|
|
|
|
// Fixed factory method
|
|
factory BannerModel.fromJson(Map<String, dynamic> json) {
|
|
return BannerModel(
|
|
id: json['id'] as int,
|
|
|
|
documentUrl:
|
|
json['document1']
|
|
as String, // Use the document1 field which contains the full URL
|
|
createdDate: json['created_date'] as String,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {'id': id, 'document1': documentUrl, 'created_date': createdDate};
|
|
}
|
|
|
|
// Convenience method to get the image URL if needed
|
|
String get imageUrl => documentUrl;
|
|
}
|