caller_info 0.0.9
caller_info: ^0.0.9 copied to clipboard
Caller info (caller, closure, file, frame, line, method, source, type).
caller_info #
Caller info (caller, closure, file, frame, line, method, source, type).
import 'package:caller_info/caller_info.dart';
void main() {
printInfo(new CallerInfo());
new Foo().test();
}
class Foo {
void test() {
(() => printInfo(new CallerInfo()))();
}
}
void printInfo(CallerInfo ci) {
print("==============");
print("frame: ${ci.frame}");
print("source: ${ci.source}");
print("file: ${ci.file.path}");
print("line: ${ci.line}");
print("caller: ${ci.caller}");
print("type: ${ci.type}");
print("method: ${ci.method}");
print("closure: ${ci.closure}");
}
Output:
==============
frame: main (file:///home/andrew/dart/caller_info/example/example.dart:4:17)
source: file:///home/andrew/dart/caller_info/example/example.dart
file: /home/andrew/dart/caller_info/example/example.dart
line: 4
caller: main
type:
method: main
closure: false
==============
frame: Foo.test.<anonymous closure> (file:///home/andrew/dart/caller_info/example/example.dart:10:26)
source: file:///home/andrew/dart/caller_info/example/example.dart
file: /home/andrew/dart/caller_info/example/example.dart
line: 10
caller: Foo.test.<anonymous closure>
type: Foo
method: test
closure: true