load products
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:worker/features/favorites/data/datasources/favorites_local_datasource.dart';
|
||||
import 'package:worker/features/favorites/data/models/favorite_model.dart';
|
||||
import 'package:worker/features/products/data/datasources/products_local_datasource.dart';
|
||||
import 'package:worker/features/products/data/repositories/products_repository_impl.dart';
|
||||
import 'package:worker/features/products/domain/entities/product.dart';
|
||||
import 'package:worker/features/products/domain/usecases/get_products.dart';
|
||||
import 'package:worker/features/products/presentation/providers/products_provider.dart';
|
||||
|
||||
part 'favorites_provider.g.dart';
|
||||
|
||||
@@ -251,12 +250,9 @@ Future<List<Product>> favoriteProducts(Ref ref) async {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Import products provider to get all products
|
||||
const productsRepository = ProductsRepositoryImpl(
|
||||
localDataSource: ProductsLocalDataSourceImpl(),
|
||||
);
|
||||
|
||||
const getProductsUseCase = GetProducts(productsRepository);
|
||||
// Get products repository with injected dependencies
|
||||
final productsRepository = await ref.watch(productsRepositoryProvider.future);
|
||||
final getProductsUseCase = GetProducts(productsRepository);
|
||||
final allProducts = await getProductsUseCase();
|
||||
|
||||
// Filter to only include favorited products
|
||||
|
||||
@@ -440,4 +440,4 @@ final class FavoriteProductsProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$favoriteProductsHash() => r'6f48aa57781b0276ad72928e6b54b04fc53b0d7e';
|
||||
String _$favoriteProductsHash() => r'630acfbc403cc4deb486c7b0199f128252a8990b';
|
||||
|
||||
Reference in New Issue
Block a user