cpd_2022_zi/lib/mock/db_mock.dart

24 lines
738 B
Dart
Raw Normal View History

import 'package:smoke_cess_app/interface/db_record.dart';
import 'package:smoke_cess_app/models/mood.dart';
import 'package:smoke_cess_app/models/sleep.dart';
class DatabaseMock {
final List<DatabaseRecord> _moodRecords = [];
final List<DatabaseRecord> _sleepRecords = [];
final List<DatabaseRecord> _workoutRecords = [];
void saveRecord(DatabaseRecord record) {
if (record is Mood) {
_moodRecords.add(record);
} else if (record is Sleep) {
_sleepRecords.add(record);
} else {
_workoutRecords.add(record);
}
}
List<DatabaseRecord> getMoodRecords() => _moodRecords;
List<DatabaseRecord> getSleepRecords() => _sleepRecords;
List<DatabaseRecord> getWorkoutRecords() => _workoutRecords;
}