I know that I can require one parameter using @required like below :
class Foo{
String firstParam;
String secondParam;
Foo({@required this.firstParam, this.secondParam});
}
However, I don't know how to require only one of the two parameters without requiring both. I have something that looks like what I want using assert :
class Foo{
String firstParam;
String secondParam;
Foo({this.firstParam, this.secondParam}): assert(this.firstParam != null || this.secondParam!= null);
}
But it doesn't warn me in VS Code and asserts are not used in Release mode.
Is there some way to do it in Dart?
