future_ sync_ value
Learn about the future_sync_value linter rule.
For synchronous values, Future.syncValue is more performant.
Details
#DO use Future.syncValue when the argument is synchronous.
BAD:
Future<int> f() => Future.value(1);
GOOD:
Future<int> f() => Future.value(1);
Enable
#
To enable the future_sync_value rule, add future_sync_value under
linter > rules in your analysis_options.yaml
file:
linter:
rules:
- future_sync_value
If you're instead using the YAML map syntax to configure linter rules,
add future_sync_value: true under linter > rules:
linter:
rules:
future_sync_value: true
Unless stated otherwise, the documentation on this site reflects Dart 3.12.2. Report an issue.