move dart code from inline script to separate file