How do I unconditionally exit a Dart application?

dart

Solution

To exit the VM:

import 'dart:io';

main() {
  exit(0); // or non-zero for some error code
}

Which is documented here. Thanks for asking!

Problem

In a server-side VM app, with a few Futures which may or may not return. How to unconditionally exit the app?

Original source