mirror of
https://gitlab.com/foxixus/neomovies_mobile.git
synced 2025-10-28 03:58:50 +05:00
v0.0.3
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
class Favorite {
|
||||
final int id;
|
||||
final String id; // MongoDB ObjectID as string
|
||||
final String mediaId;
|
||||
final String mediaType;
|
||||
final String mediaType; // "movie" or "tv"
|
||||
final String title;
|
||||
final String posterPath;
|
||||
final DateTime? createdAt;
|
||||
|
||||
Favorite({
|
||||
required this.id,
|
||||
@@ -13,15 +14,19 @@ class Favorite {
|
||||
required this.mediaType,
|
||||
required this.title,
|
||||
required this.posterPath,
|
||||
this.createdAt,
|
||||
});
|
||||
|
||||
factory Favorite.fromJson(Map<String, dynamic> json) {
|
||||
return Favorite(
|
||||
id: json['id'] as int? ?? 0,
|
||||
id: json['id'] as String? ?? '',
|
||||
mediaId: json['mediaId'] as String? ?? '',
|
||||
mediaType: json['mediaType'] as String? ?? '',
|
||||
mediaType: json['mediaType'] as String? ?? 'movie',
|
||||
title: json['title'] as String? ?? '',
|
||||
posterPath: json['posterPath'] as String? ?? '',
|
||||
createdAt: json['createdAt'] != null
|
||||
? DateTime.tryParse(json['createdAt'] as String)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user