option<T, Input> static method
Implementation
static BcsType<T?, Input?> option<T, Input>(BcsType<T, Input> type) {
return enumeration('Option<${type.name}>', {
'None': null,
'Some': type,
}).transform(
input: (Input? value) {
if (value == null) {
return {'None': true};
}
return {'Some': value};
},
output: (value) {
if (value.containsKey('Some')) {
return value['Some'] as T;
}
return null;
},
);
}