28 lines
704 B
Dart
28 lines
704 B
Dart
import 'package:demo_hive/domain/entity/reminder.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'local_init.dart';
|
|
|
|
class LocalDatabaseSetUp{
|
|
LocalDBInit init;
|
|
LocalDatabaseSetUp({@required this.init});
|
|
|
|
|
|
Future<List<ReminderEntity>> getList() async {
|
|
List<ReminderEntity> reminders = [];
|
|
if(init.unitBox.length != null) {
|
|
reminders.addAll(init.unitBox.values.toList());
|
|
}
|
|
return reminders;
|
|
}
|
|
Future<void>deleteFromBox(int index) async{
|
|
await init.unitBox.deleteAt(index);
|
|
}
|
|
|
|
Future<void> addNoteBox(ReminderEntity reminderEntity)async{
|
|
await init.unitBox.add(reminderEntity);
|
|
}
|
|
|
|
Future<void> removeAll()async{
|
|
await init.unitBox.clear();
|
|
}
|
|
} |