Group: style
Maturity: stable
Dart SDK: >= 2.14.0 • (Linter v1.3.0)
Since info is static, may be staleInstead of checking nullability of a function/method f
before calling it you
can use f?.call()
.
BAD:
if (f != null) f!();
GOOD:
f?.call();
To enable the prefer_null_aware_method_calls
lint,
add prefer_null_aware_method_calls
under linter > rules in your
analysis_options.yaml
file:
linter:
rules:
- prefer_null_aware_method_calls