Closed pedromassango closed 3 years ago
It is really needed? The assert can be placed directly inside the function:
@swidget
Widget example(int value) {
assert(value > 0);
return Container();
}
My doubt is if the assert will be called since we will use the generated widget istead of the function. Yes it is needed sometimes I need to put some restrictions in the provided parameters.
The generated widget calls your function, so asserts will be called correctly
Closing since I believe supporting asserts on the constructor when we can place asserts inside the function has a low benefit
I'm open to pull-requests though
Does declaring a widget as a function support parameters's assert?
Most of the times I writ my code as:
How do I write the assert so that this package can apply in the generated widget? If I write it in the fuction it will be moved in the generated widget as well?