Replies: 1 comment
-
Hi, I used to have Also, String? s = null;
s?.let(print); // Doesn't print anything
s.maybeWhere((s) => s.isNotEmpty); // null
''.maybeWhere((s) => s.isNotEmpty); // null
s = 'test';
s?.let(print); // Prints 'test'
s.maybeWhere((s) => s.isNotEmpty); // 'test' Let me know if you have some use case in mind, not covered by that. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm following Reso Coder's DDD example. On course 4 at 23:32 he goes into explaining wrapping Either<> with Option<None, Some>. It's a check that returns none if nothing, or true if something. This is a way to check if a state is active or not in this example. Since dartz isn't null safety, I'm using your helpful library.
https://pub.dev/documentation/dartz/latest/dartz/Option-class.html is the option class.
Would it be possible getting this feature added?
update: After requesting this, with a little more research I found: oxidized. It's a null safe API that has a few handy features, to include Option: https://pub.flutter-io.cn/documentation/oxidized/latest/oxidized/Option-class.html It works fine with dfunc
Beta Was this translation helpful? Give feedback.
All reactions