Why does dart complain "The default value of an optional parameter must be constant". How do I make the map value constant
Map<String, int> toastDuration = {
"defaut": 4000,
};
void showToast({
BuildContext context,
String msg,
int msDuration = toastDuration["default"], // Error: The default value of an optional parameter must be constant
bool hidePrev = true,
}) {
....
}
I tried adding const but that didn't work as it expects map part to be a class.
int msDuration = const toastDuration["default"],