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

void_checks: allow assigning any future to a FutureOr<void> #4699

Open
frmrgr opened this issue Aug 16, 2023 · 0 comments
Open

void_checks: allow assigning any future to a FutureOr<void> #4699

frmrgr opened this issue Aug 16, 2023 · 0 comments
Labels
P3 A lower priority bug or feature request set-core Affects a rule in the core Dart rule set type-enhancement A request for a change that isn't a bug

Comments

@frmrgr
Copy link

frmrgr commented Aug 16, 2023

Describe the quick-fix

import 'dart:async';

void foo(FutureOr<void> x) {}

void main() {
  final intFuture = Future<int>.value(1);
  foo(intFuture); // <-- This lints
  foo((intFuture as dynamic) as FutureOr<int>); // <-- This is allowed
}

It would be great if any future could be passed into a FutureOr<void> argument. Anyway, the only reasonable thing is to await it; and passing a FutureOr<Whatever> is already allowed.

Basically remove the && ... part from the rule.

@github-actions github-actions bot added the set-core Affects a rule in the core Dart rule set label Aug 16, 2023
@bwilkerson bwilkerson added the P3 A lower priority bug or feature request label Aug 16, 2023
@srawlins srawlins added the type-enhancement A request for a change that isn't a bug label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 A lower priority bug or feature request set-core Affects a rule in the core Dart rule set type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants