tiendita library
A Flutter package for interacting with the Fake Store API.
This package provides an easy-to-use interface for fetching products and managing carts from the Fake Store API (https://fakestoreapi.com).
Usage
import 'package:tiendita/tiendita.dart';
// Create a repository instance
final productRepository = ProductRepository();
// Fetch all products
final result = await productRepository.getProducts();
switch (result) {
case Ok(:final value):
print('Got ${value.length} products');
case Error(:final error):
print('Error: $error');
}
Classes
- Address
- Address information for a user.
- AuthRepository
- Repository for managing authentication.
- Cart
- Cart model from Fake Store API.
- CartProduct
- Product item within a cart.
- CartRepository
- Repository for managing cart data.
-
Error<
T> - Subclass of Result for errors
- FakeStoreApiService
- Service for interacting with the Fake Store API.
- Geolocation
- Geolocation data for an address.
- LoginResponse
- Login response containing the authentication token.
- Name
- Name information for a user.
-
Ok<
T> - Subclass of Result for values
- Product
- Product model from Fake Store API.
- ProductRepository
- Repository for managing product data.
- Rating
- Rating information for a product.
-
Result<
T> - Utility class to wrap result data
- User
- User model from Fake Store API.
- UserRepository
- Repository for managing user data.
Exceptions / Errors
- AuthException
- Exception thrown when authentication fails
- NetworkException
- Exception thrown when a network error occurs
- NotFoundException
- Exception thrown when a resource is not found
- ParseException
- Exception thrown when parsing data fails
- ServerException
- Exception thrown when the server returns an error response
- TienditaException
- Base exception for Tiendita package