VB10 / flutter-architecture-template

Flutter Architecture Complete App
https://vb10.dev/#/
Apache License 2.0
650 stars 130 forks source link

Network Layer #36

Closed behlsoft closed 3 years ago

behlsoft commented 3 years ago

Hi team In your API service class you are just checking if response is type of particular type (model) thn only return else null... so how can you show user exact error that what happen .. Example in login, user can put wrong OTP so we have to show "Invalid OTP" or may be user enter expired OTP so we need to show "OTP expired" But in your case we cant show this. Or may be i am wrong ... please suggest a way am using Vexana

`final response = await manager.send<LoginResponseModel, LoginResponseModel>(NetworkRoutes.LOGIN.rawValue, parseModel: LoginResponseModel(), method: RequestType.POST, data: model);

if (response.data is LoginResponseModel) {
  return response.data;
} else {
  return null;
}`
VB10 commented 3 years ago

hello @behlsoft, of course, you have many scenarios for error state so vexana give response.error options for u. For example you can use like this: image