30 lines
639 B
Dart
30 lines
639 B
Dart
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
class ConnectionCubit extends Cubit<ConnectionCubitState> {
|
|
static final ConnectionCubit _instance = ConnectionCubit._internal();
|
|
|
|
ConnectionCubit._internal() : super(ConnectionCubitState.init());
|
|
|
|
factory ConnectionCubit.getInstance() {
|
|
return ConnectionCubit();
|
|
}
|
|
|
|
factory ConnectionCubit() {
|
|
return _instance;
|
|
}
|
|
|
|
void reconnect() {
|
|
emit(ConnectionCubitState(true));
|
|
}
|
|
}
|
|
|
|
class ConnectionCubitState {
|
|
final bool reconnecting;
|
|
|
|
ConnectionCubitState(this.reconnecting);
|
|
|
|
factory ConnectionCubitState.init() {
|
|
return ConnectionCubitState(false);
|
|
}
|
|
}
|