Since a compilation is required before launching a dart application, i wonder if compiler preprocessor is available, or is scheduled in a near future for Dart.
My search
No, there isn't, and I doubt there will be.
For your first example, the equivalent would just be to define max(a, b) => a > b ? a: b;
Or, more simply import "dart:math";
which includes that already.
The equivalent of the second would be a typedef for NumType, but right now Dart typedefs only work for function types. More general typedefs seem likely to show up in later versions. For the 0.0 part, just const numTypeZero = 0.0;
There is no equivalent to ifdef for conditional code execution right now. However, if at the beginning of your program you defined const DEBUG = false; and wrote if (DEBUG) print("stuff");
that would accomplish roughly what you want.
The things you're looking for are very much C idioms, and often intended for performance. Dart's compiler is quite clever, and does not need some of these.
So, for example, defining max that way is presumably to force it to be inlined. Dart will inline it all by itself if it thinks it's worthwhile, and has the ability to change its mind part-way through execution. Declaring something as "const" makes it a compile-time constant, so is pretty much the same effect as a #define. The ability to reduce the code size by defining symbols like DEBUG is something Dart is missing right now, although conditional compilation is probably more important for other reasons than size. If you're running in a browser, and the compiler is in the browser, then the point of reduced code size is in the download. If you wait until the compiler runs, it's too late, you've already downloaded the code. If you compile to JS ahead of time, it would omit the code in the if statement qualified by a constant false. There's also a dart2dart mode which would do those sorts of transformations, as well as minification on Dart source. But that's less important until there are browsers that are running Dart natively.