Option<T extends CandidType> constructor

Option<T extends CandidType>({
  1. T? value,
  2. T? value_type,
  3. bool isTypeStance = false,
})

Implementation

Option({this.value, this.value_type, this.isTypeStance=false}) {
    if (isTypeStance==true) {
        if (value_type==null) {
            throw Exception('for an Option as a type-stance is with the value_type-parameter-quirement by the class-rules.');
        }
        if (value!=null) {
            throw Exception('for an Option as a type-stance is with the value-parameter-null-quirement by the class-rules.');
        }
    } else {
        if (value==null && value_type==null) {
            throw Exception('an Option needs either a CandidType value, or if the value is null: an Option needs the value_type-parameter set to a CandidType-[in]stance with the isTypeStance=true');
        }
    }
    if (value_type!=null) {
        if (value_type!.isTypeStance==false) {
            throw Exception('The value_type CandidType must have .isTypeStance == true');
        }
    }
}