fnotes/lib/persistence_bloc.dart

28 lines
727 B
Dart

import 'package:flutter_bloc/flutter_bloc.dart';
class PersistenceBloc extends Bloc<PersistenceEvent, PersistenceState> {
PersistenceBloc() : super(PersistenceState.init()) {
on<StoreNotesEvent>(storeAllNotes);
on<LoadNotesEvent>(loadAllNotes);
}
void storeAllNotes(PersistenceEvent event, Emitter<PersistenceState> emit) {}
void loadAllNotes(PersistenceEvent event, Emitter<PersistenceState> emit) {}
}
class PersistenceEvent {}
class LoadNotesEvent extends PersistenceEvent {}
class StoreNotesEvent extends PersistenceEvent {}
class PersistenceState {
int lastIndex;
PersistenceState({required this.lastIndex});
factory PersistenceState.init() {
return PersistenceState(lastIndex: 0);
}
}