sync page
This commit is contained in:
@@ -406,7 +406,7 @@ class ProductLocalDataProvider {
|
||||
|
||||
Future<double> _getDatabaseSize() async {
|
||||
try {
|
||||
final dbPath = p.join(await getDatabasesPath(), 'db_pos.db');
|
||||
final dbPath = p.join(await getDatabasesPath(), AppConstant.dbName);
|
||||
final file = File(dbPath);
|
||||
if (await file.exists()) {
|
||||
final size = await file.length();
|
||||
|
||||
@@ -347,4 +347,32 @@ class ProductRepository implements IProductRepository {
|
||||
return left(ProductFailure.dynamicErrorMessage(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<ProductFailure, ListProduct>> getRemoteProducts({
|
||||
int page = 1,
|
||||
int limit = 10,
|
||||
String? categoryId,
|
||||
String? search,
|
||||
}) async {
|
||||
try {
|
||||
final result = await _remoteDataProvider.fetchProducts(
|
||||
page: page,
|
||||
limit: limit,
|
||||
categoryId: categoryId,
|
||||
search: search,
|
||||
);
|
||||
|
||||
if (result.hasError) {
|
||||
return left(result.error!);
|
||||
}
|
||||
|
||||
final products = result.data!.toDomain();
|
||||
|
||||
return right(products);
|
||||
} catch (e, s) {
|
||||
log('getProducts', name: _logName, error: e, stackTrace: s);
|
||||
return left(const ProductFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user