To answer my own question, this can be done, but not through the media. The solution is to dynamically load the correct script:
<script> var scriptSrc = 'firstScript.dart'; if (screen.width <= 800) scriptSrc = 'secondScript.dart'; var script = document.createElement('script'); script.type = "application/dart"; script.src = scriptSrc; var body = document.getElementsByTagName('body')[0]; body.appendChild(script); </script>
source share