fromResponse static method

CategoryEntity fromResponse({
  1. required CategoryResponse? response,
})

Implementation

static CategoryEntity fromResponse({
  required CategoryResponse? response,
}) =>
    CategoryEntity(
      id: response?.id ?? 0,
      parentId: response?.parentId ?? 0,
      humanReadableId: response?.humanReadableId ?? '',
      imageUrl: response?.icon != null && response!.icon!.isNotEmpty
          ? '${FlavorConfig.config.catalogUrl}api/v1/images${response.icon}'
          : null,
      name: response?.name ?? '',
      subcategories: response?.children
              ?.map(
                (CategoryResponse subcategory) =>
                    CategoryMapper.fromResponse(response: subcategory),
              )
              .toList() ??
          <CategoryEntity>[],
    );