No Description

event.dart 874B

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