The documentation about Inline Functions declares ...
# announcements
The documentation about Inline Functions declares that
is used as
Copy code
The inline modifier affects both the function itself and the lambdas passed to it: all of those will be inlined into the call site.

In case you want only some of the lambdas passed to an inline function to be inline, you can mark some of your function parameters with the noinline modifier:
What If I do not need to make the whole function inline but want that its passed lambdas are made inline? For example my function have private fields and to make it inline it is necessary to annotate the whole function with
. If a function with lambda arguments is not marked as
will the compiler smart enough to inline the lambda in the function body if the only lambda usage is its invocation?
You can only inline a lambda parameter if the function is inlined. I'm not sure how you want the compiler to inline a lambda, but not inline the function you're calling...
Thank you. I see now that it is not possible to inline a lambda inside of a method because the lambda body is not known at that location.
Also do not use
. Use
visibility for those non-public declarations that you want to call from the inline function.
What about if I use private variables in a function which is declared inline? Should such private variables be declared as internal instead?
If the function is public, they have to be either public or internal+@PublishedApi