Reputation: 4648
In Objective-C I can log the current function name using __func__
from C99
:
NSLog(@"%s", __func__);
How can I do this in Dart?
Upvotes: 5
Views: 2821
Reputation: 71663
You can't in general. Dart does not have such a feature.
What you can do is to take the first line of StackTrace.current.toString()
write that in your log. The stack_trace package may help you parse the stack trace. It knows about the most common stack trace formats.
Upvotes: 9