Init mailbox feature add presentation layer

This commit is contained in:
dab246
2021-07-27 12:56:27 +07:00
committed by Dat H. Pham
parent 8772126a3f
commit cab53453b5
18 changed files with 1170 additions and 1 deletions
+23
View File
@@ -0,0 +1,23 @@
import 'package:core/core.dart';
import 'package:dartz/dartz.dart';
import 'package:get/get.dart';
abstract class BaseController extends GetxController {
final viewState = Rx<Either<Failure, Success>>(Right(UIState.idle));
void consumeState(Stream<Either<Failure, Success>> newStateStream) async {
newStateStream.listen(
(state) => onData(state),
onError: (error) => onError(error),
onDone: () => onDone()
);
}
void onData(Either<Failure, Success> newState) {
viewState.value = newState;
}
void onError(dynamic error);
void onDone();
}