簡體   English   中英

"肘不發光狀態"

[英]Cubit not emitting state

伙計們,我需要一些幫助。

我有這個代碼

  void onLoad(int id) async {
    final result = await ListRepository.loadProduct(id);

    if (result != null) {
      product = result;

      WoocommerceModel? model = product!.woo;

      if (model!.woocommerce) {
        List? result2 = await ListRepository.loadOffsiteCoupon(model: model);

        emit(ProductOffsiteCouponSuccess(result2));
      }

      emit(ProductDetailSuccess(product!));
    }
  }

如果您使用帶有優惠券的特定類型(如 List)並且它不是 String 或 int,那么您應該使用 Equatable 擴展它以及抽象類並將其變量添加到 props,即使這不起作用,您也可以嘗試toSet().toList()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM