enum PromoCodeStatus { initial, loading, success, failure } class PromoCodeState { final PromoCodeStatus status; final double? newBalance; final String? errorMessage; const PromoCodeState({ this.status = PromoCodeStatus.initial, this.newBalance, this.errorMessage, }); PromoCodeState copyWith({ PromoCodeStatus? status, double? newBalance, String? errorMessage, }) { return PromoCodeState( status: status ?? this.status, newBalance: newBalance ?? this.newBalance, errorMessage: errorMessage ?? this.errorMessage, ); } }