Skip to content

Instantly share code, notes, and snippets.

@anovsiradj
Created June 9, 2022 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anovsiradj/8bd4355eb1171b8ef36ade8e6d2fb899 to your computer and use it in GitHub Desktop.
Save anovsiradj/8bd4355eb1171b8ef36ade8e6d2fb899 to your computer and use it in GitHub Desktop.
dynamic variable dumper
// https://stackoverflow.com/a/53765893
class _DumpV1 {
@override
noSuchMethod(Invocation invocation) {
print(invocation.memberName);
int index = invocation.memberName.toString().length;
for (final e in invocation.positionalArguments) {
print(e);
if (index < e.toString().length) index = e.toString().length;
if (index > 1024) index = 1024;
}
// https://stackoverflow.com/a/56757506
print('―' * index);
}
}
dynamic dumpV1() {
final dynamic dump = _DumpV1();
return dump;
}
void main() {
dumpV1().title_of_this_dump(0, 0.1, [], {});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment