Creating Products States

First, create the "products_state.dart" file under src/product/cubit/products/ with the following code.

part of 'products_cubit.dart';

@freezed
abstract class ProductsState with _$ProductsState {
  const factory ProductsState.error({@required String error}) =
      ProductsErrorState;

  const factory ProductsState.refreshing() = ProductsRefreshingState;

  const factory ProductsState.initial() = InitialProductsState;

  const factory ProductsState.loaded({
    @required List<Product> products,
  }) = ProductsLoadedState;

  const factory ProductsState.loading() = ProductsLoadingState;
}

Last updated