tryInline top-level constant

const tryInline = const _TryInline()

An annotation for methods method to request that dart2js always inlines the method.

dart2js will attempt to inline the method regardless of its size. Even with this annotation, there are conditions that can prevent dart2js from inlining a method, including complex control flow.

import 'package:meta/dart2js.dart' as dart2js;

@dart2js.tryInline
String bigMethod() {
  for (int i in "Hello".runes) print(i);
}

It is an error to use both @noInline and @tryInline on the same method.

Implementation

const _TryInline tryInline = const _TryInline()