1
0
mirror of https://github.com/h7x4/Jisho-Study-Tool.git synced 2024-12-22 22:07:29 +01:00
Jisho-Study-Tool/lib/bloc/database/database_bloc.dart

25 lines
579 B
Dart
Raw Normal View History

2021-07-17 16:11:17 +02:00
import 'package:flutter_bloc/flutter_bloc.dart';
import './database_event.dart';
import './database_state.dart';
export './database_event.dart';
export './database_state.dart';
export './database_not_connected_exception.dart';
class DatabaseBloc extends Bloc<DatabaseEvent, DatabaseState> {
DatabaseBloc() : super(DatabaseDisconnected());
@override
Stream<DatabaseState> mapEventToState(DatabaseEvent event)
async* {
if (event is ConnectedToDatabase) {
yield DatabaseConnected(event.database);
} else {
yield DatabaseDisconnected();
}
}
}