first commit
This commit is contained in:
35
lib/domain/provider/product/all_products.dart
Normal file
35
lib/domain/provider/product/all_products.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import '../../../Helper/Logger.dart';
|
||||
import '../../../modules/product/product.dart';
|
||||
import '../../../service/dio.dart';
|
||||
|
||||
|
||||
class ProductsProvider {
|
||||
final CustomDio customDio = CustomDio();
|
||||
|
||||
Future<ProductResponse?> getProductsBySubCategory({
|
||||
required int categoryId,
|
||||
required int tenantId, required int locationId,
|
||||
}) async {
|
||||
final url =
|
||||
"https://fiesta.nearle.app/live/api/v1/mob/products/getproductsbysubcategory?categoryid=2&tenantid=$tenantId&locationid=$locationId";
|
||||
logger.i("GET ProductsBySubCategory URL: $url");
|
||||
|
||||
ProductResponse? responseModel;
|
||||
|
||||
try {
|
||||
final response = await customDio.getData(url);
|
||||
|
||||
if (response != null) {
|
||||
// logger.i(response);
|
||||
responseModel = ProductResponse.fromJson(response);
|
||||
// logger.i("GET Products Response: ${jsonEncode(responseModel.toJson())}");
|
||||
}
|
||||
} catch (e) {
|
||||
logger.e("Error in getProductsBySubCategory: $e");
|
||||
}
|
||||
|
||||
return responseModel;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user