sendDamageRequest method

  1. @override
Future<Either<AppException, Response>> sendDamageRequest(
  1. String scanCode,
  2. String reason,
  3. String note,
  4. String file,
)
override

Implementation

@override
Future<Either<AppException, response.Response>> sendDamageRequest(
    String scanCode, String reason, String note, String file) async {
  try {
    final eitherType =
        await networkService.postFileUpload('damage_product/add', data: {
      'serialno': scanCode,
      'reason': reason,
      'notes': note,
    }, files: [
      File(file)
    ]);
    return eitherType.fold(
      (exception) {
        return Left(exception);
      },
      (response) {
        return Right(response);
      },
    );
  } catch (e) {
    return Left(
      AppException(
        message: 'Unknown error occured',
        statusCode: 1,
        identifier: '${e.toString()}\nLoginUserRemoteDataSource.loginUser',
      ),
    );
  }
}