currentScript

This small one-function library allows to detect actual current script name in Dart.

It gets current stack trace (via stack_trace package) and gives you File object of last caller filename.

Example usage:

import 'package:current_script/current_script.dart';    
print(currentScript());
print(currentScript().parent); // will give you current file directory

Libraries

current_script