getCartById method

  1. @override
Future<Either<Failure, Cart>> getCartById(
  1. int id
)
override

Implementation

@override
Future<Either<Failure, Cart>> getCartById(int id) async {
  final result = await _gateway.getCartById(id);
  return result.fold(
    Left.new,
        (json) {
      try{
        final cart = Cart.fromJson(json);
        return Right(cart);
      }catch(e, stackTrace){
        return Left(
          Failure(
            title: 'Error en el UserRepositoryImpl',
            code: 'mapping_error',
            description: "Error al mapear el carrito obtenido por id ",
            stackTrace: stackTrace.toString(),
            type: FailureSeverity.blocking
          )
        );
      }
    });


}