TF-2638 create mixin for getOptionParam

This commit is contained in:
Dat PHAM HOANG
2024-02-27 11:54:19 +07:00
committed by Dat H. Pham
parent 6fdc81b053
commit 9610587353
2 changed files with 12 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
import 'package:dartz/dartz.dart';
mixin OptionParamMixin {
T? getOptionParam<T>(Option<T?>? option, T? defaultValue) {
if (option != null) {
return option.toNullable();
} else {
return defaultValue;
}
}
}