We'd like to have code that does something like this:
// these are giant maps
const Map mac = {...};
const Map windows = {...};
const Map linux = {...};
convert(foo) {
if (Platform.isMac)
return mac[foo];
if (Platform.isLinux)
return linux[foo];
if (Platform.isWindows)
return windows[foo];
return null;
}
We only want to ship the maps that apply to the current platform; we'd like the others to tree-shake out.
cc @gspencergoog
Hi. I'm the new maintainer of dart:io. I actually ran into this issue the other day, I agree it would be nice for them to be const.
Seems to be related to #31969
Any idea on where this issue is in the priorities for the SDK? This would be pretty useful, especially now that flutter is expanding to more platforms.
Hi Greg. I'm hoping to do some work on this issue this quarter so flutter for web is better supported. I'm writing up a plan and will be sharing it.
@sortie Please re-evaluate this and do one of the following:
Most helpful comment
Hi. I'm the new maintainer of dart:io. I actually ran into this issue the other day, I agree it would be nice for them to be const.