Created
September 8, 2021 11:39
-
-
Save PreyeaRegmi/743889d96e74fde19141edd0e7b3f2c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoanDetailResponse { | |
final String _emi; | |
LoanDetailResponse(this._emi); | |
static from(EMICalculator emiCalculator) { | |
return LoanDetailResponse(emiCalculator.calculateEMI().toString()); | |
} | |
} | |
class FetchLoanDetail extends UseCase<LoanParamRequest, LoanDetailResponse> { | |
final ILoanRepository _loanRepository; | |
FetchLoanDetail(this._loanRepository); | |
@override | |
Stream<LoanDetailResponse> buildUseCase(LoanParamRequest param) { | |
return _loanRepository | |
.getLoanFromServer(param.amount, param.time) | |
.asStream() | |
.map((loanDetailDTO) => LoanDetailResponse.from(EMICalculator(param.amount,loanDetailDTO._rate,param.time))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment