Skip to main content

prefer-both-inlining-annotations

added in: 1.11.0
🛠

Warns when a @pragma('vm:prefer-inline') annotation does not have a corresponding @pragma('dart2js:tryInline') annotation.

info

Enable this rule only if you compile your code to JS and use inlining annotations.

Example

❌ Bad:

// LINT
('vm:prefer-inline')
Future<String> bad() {
return Future.value('hello');
}

✅ Good:

('dart2js:tryInline')
('vm:prefer-inline')
Future<void> good() async {
return Future.value('hello');
}