25 lines
825 B
Dart
25 lines
825 B
Dart
|
import 'package:demo_hive/domain/entity/reminder.dart';
|
||
|
import 'package:demo_hive/domain/repositories/reminder_repository.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:demo_hive/list_extensions.dart';
|
||
|
class RemindersUseCase{
|
||
|
final ReminderRepository reminderRepository;
|
||
|
RemindersUseCase({@required this.reminderRepository});
|
||
|
|
||
|
Future<List<ReminderEntity>> getFull() async{
|
||
|
List<ReminderEntity> reminders = await reminderRepository.getList();
|
||
|
if(reminders.isSafe){
|
||
|
return reminders;
|
||
|
}
|
||
|
return [];
|
||
|
}
|
||
|
Future<void> addNote(ReminderEntity reminderEntity){
|
||
|
return reminderRepository.addReminder(reminderEntity);
|
||
|
}
|
||
|
Future<void> removeAt(int index){
|
||
|
return reminderRepository.removeAt(index);
|
||
|
}
|
||
|
Future<void> removeAll(){
|
||
|
return reminderRepository.removeAll();
|
||
|
}
|
||
|
}
|