import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../app.dart';

void navigateToProductListScreen(Map<String, dynamic> params) {
  final Map<String, dynamic> queryParams = {
    params['type']: params['id'],
  };

  debugPrint('queryParams $queryParams');

  /// [FilterController]
  Get.delete<FilterController>();

  Get.putAsync<FilterController>(() async => FilterController(queryParams))
      .then(
        (fc) => fc.state.filterableQueryParams.value = queryParams,
      )
      .then(
        (value) => Get.toNamed(AppRoutes.PRODUCT_LIST, arguments: params),
      );
}
