Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow letOrNull to return R? #61

Merged
merged 1 commit into from
Aug 30, 2024
Merged

Allow letOrNull to return R? #61

merged 1 commit into from
Aug 30, 2024

Conversation

passsy
Copy link
Owner

@passsy passsy commented Aug 30, 2024

Before

final String? a = pick('a').letOrNull((pick) => null);
// error: The return type 'Null' isn't a 'String', as required by the closure's context. (return_of_invalid_type_from_closure

// Workaround
final String? a = pick('a').letOrNull<String?>((pick) => null);

After

final String? a = pick('a').letOrNull((pick) => null); // no error

@passsy passsy merged commit 2d37c70 into main Aug 30, 2024
10 checks passed
@passsy passsy deleted the allow_let_null branch August 30, 2024 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant