'The default value of an optional parameter must be constant. Dart

I tried to make a default map parameter but it just goes errors for some reason,

var size = {
  "width": 1920,
  "height": 1080,
};

class MyClass {
  myFunction([String MyParam = "Sup!", Map background_size = size]) async {
    return background_size.width;
  }
}

It only gives me an errors like this The default value of an optional parameter must be constant. Can someone tell me which lines I type wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source