How do you initialize a List<Object> in a constructor when using null safety in flutter without the required keyword ?
I have the following code :
List<String> test = [];
MyConstructor({this.test});
There is a compile error telling me to add the required keyword, but if i do :
List<String> test = [];
MyConstructor({this.test=[]});
This gives me an error that the default value of a named param must be constant.
Of course i can put the required keyword and everything is fine, but in all of my constructors i need to add an empty List it's quite boring because only in 10% of the time i need to pass a non empty List.
Can you simply confirm that the required keyword is the only option ?
Thanks