Improve repo structure (#22)
* app updated * readme updated * rename base folder * update chatty's readme * move apps to packages dir * update repo overview Co-authored-by: diegoveloper <[email protected]>
This commit is contained in:
co-authored by
diegoveloper
parent
bd6bb66279
commit
030c3eb428
@@ -0,0 +1,29 @@
|
||||
import 'package:stream_chatter/domain/usecases/login_usecase.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
enum SignInState {
|
||||
none,
|
||||
existing_user,
|
||||
}
|
||||
|
||||
class SignInCubit extends Cubit<SignInState> {
|
||||
SignInCubit(
|
||||
this._loginUseCase,
|
||||
) : super(SignInState.none);
|
||||
|
||||
final LoginUseCase _loginUseCase;
|
||||
|
||||
void signIn() async {
|
||||
try {
|
||||
final result = await _loginUseCase.validateLogin();
|
||||
if (result) {
|
||||
emit(SignInState.existing_user);
|
||||
}
|
||||
} catch (ex) {
|
||||
final result = await _loginUseCase.signIn();
|
||||
if (result != null) {
|
||||
emit(SignInState.none);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user