AddTote method

  1. @override
Future<Either<AppException, Response>> AddTote(
  1. int salesId,
  2. String code,
  3. String serialNo,
  4. int boxId,
)
override

Implementation

@override
Future<Either<AppException, response.Response>> AddTote(
    int salesId, String code, String serialNo, int boxId) async {
  try {
    final eitherType = await networkService.post(
      'tote/add_item',
      data: {
        'code': code,
        'sale_id': salesId,
        'serialno': serialNo,
        'packing_box_id': boxId,
      },
    );
    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',
      ),
    );
  }
}