import 'package:smoke_cess_app/interface/db_record.dart'; class Relapse implements DatabaseRecord { final String _category; final String _comment; final DateTime _date; Relapse(this._category, this._comment, this._date); String get category => _category; DateTime get date => _date; String get comment => _comment; @override factory Relapse.fromDatabase(Map map) { DateTime date = DateTime.parse(map['date']); return Relapse(map['category'], map['comment'], date); } @override String toCSV() { return "${_date.toIso8601String()}, $_category, $_comment"; } @override Map toMap() { return { 'category': _category, 'comment': _comment, 'date': _date.toIso8601String(), }; } }