No Description

event.dart 844B

123456789101112131415161718192021222324252627282930313233343536
  1. import 'package:firebase_helpers/firebase_helpers.dart';
  2. class EventModel extends DatabaseItem{
  3. final String id;
  4. final String title;
  5. final String description;
  6. final DateTime eventDate;
  7. EventModel({this.id,this.title, this.description, this.eventDate}):super(id);
  8. factory EventModel.fromMap(Map data) {
  9. return EventModel(
  10. title: data['title'],
  11. description: data['description'],
  12. eventDate: data['event_date'],
  13. );
  14. }
  15. factory EventModel.fromDS(String id, Map<String,dynamic> data) {
  16. return EventModel(
  17. id: id,
  18. title: data['title'],
  19. description: data['description'],
  20. eventDate: data['event_date'].toDate(),
  21. );
  22. }
  23. Map<String,dynamic> toMap() {
  24. return {
  25. "title":title,
  26. "description": description,
  27. "event_date":eventDate,
  28. "id":id,
  29. };
  30. }
  31. }