PostModel class
- Inheritance
-
- Annotations
-
- @JsonSerializable.new(explicitToJson: true)
Constructors
-
PostModel({String id = '', required String title, required String content, required String authorId, List<String> tags = const [], PostStatus status = PostStatus.draft, PostVisibility visibility = PostVisibility.private, DateTime? createdAt, DateTime? updatedAt, DateTime? publishedAt})
-
-
PostModel.fromFirestore(DocumentSnapshot<Object?> doc)
-
factory
-
PostModel.fromJson(Map<String, dynamic> json)
-
factory
Methods
-
copyWith({String? id, String? title, String? content, String? authorId, List<String>? tags, PostStatus? status, PostVisibility? visibility, DateTime? createdAt, DateTime? updatedAt, DateTime? publishedAt})
→ PostModel
-
-
getCreateTimestampFields()
→ List<String>
-
Fields that should only be set on document creation (like createdAt).
override
-
getUpdateTimestampFields()
→ List<String>
-
Fields that should always be updated with server timestamp (like updatedAt).
override
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
postProcessJson(Map<String, dynamic> json, SerializationContext context)
→ Map<String, dynamic>
-
Override to add custom post-processing for specific models.
inherited
-
toCallable()
→ Map<String, dynamic>
-
Convert for Firebase callable functions.
inherited
-
toFirestore({bool isUpdate = false})
→ Map<String, dynamic>
-
Legacy method for Firestore conversion.
inherited
-
toFirestoreCreate({bool useServerTimestamp = true, List<String>? fieldsToExclude})
→ Map<String, dynamic>
-
Convert to Firestore document for CREATE operations.
inherited
-
toFirestoreRaw({List<String>? fieldsToExclude})
→ Map<String, dynamic>
-
Convert to Firestore with explicit control (advanced use).
inherited
-
toFirestoreUpdate({List<String>? fieldsToExclude})
→ Map<String, dynamic>
-
Convert to Firestore document for UPDATE operations.
inherited
-
toJson()
→ Map<String, dynamic>
-
The single generated toJson method from json_serializable.
This should be implemented by the generated code.
override
-
toString()
→ String
-
A string representation of this object.
inherited