25 lines
824 B
Dart
25 lines
824 B
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
|
|
import '../database/app_database.dart';
|
||
|
|
import '../database/daos/mood_dao.dart';
|
||
|
|
import '../database/daos/activity_dao.dart';
|
||
|
|
import '../database/daos/insight_dao.dart';
|
||
|
|
import '../database/daos/settings_dao.dart';
|
||
|
|
|
||
|
|
final appDatabaseProvider = Provider<AppDatabase>((ref) {
|
||
|
|
final db = AppDatabase();
|
||
|
|
ref.onDispose(db.close);
|
||
|
|
return db;
|
||
|
|
});
|
||
|
|
|
||
|
|
final moodDaoProvider =
|
||
|
|
Provider<MoodDao>((ref) => ref.watch(appDatabaseProvider).moodDao);
|
||
|
|
|
||
|
|
final activityDaoProvider =
|
||
|
|
Provider<ActivityDao>((ref) => ref.watch(appDatabaseProvider).activityDao);
|
||
|
|
|
||
|
|
final insightDaoProvider =
|
||
|
|
Provider<InsightDao>((ref) => ref.watch(appDatabaseProvider).insightDao);
|
||
|
|
|
||
|
|
final settingsDaoProvider =
|
||
|
|
Provider<SettingsDao>((ref) => ref.watch(appDatabaseProvider).settingsDao);
|