monarch
monarch copied to clipboard
Ignore non-story functions inside stories files
Story functions are simple functions that return a Widget
and take zero arguments. Their type is Widget Function()
.
The stories files may have functions which are not stories, i.e. functions which take parameters. Unfortunately, the code generation builders think they are candidates for story functions. Thus, they process them and they fail with an unhelpful error message.
The builders should detect these non-story functions and ignore them.
Here are some sample functions which generate error messages:
/// Function with one argument
Widget textWidget(Color textColor) =>
Text('I am a Text widget', style: TextStyle(color: textColor));
/// Private function
Widget _textWidget(Color textColor) =>
Text('I am a Text widget', style: TextStyle(color: textColor));
/// Function that returns a text widget
Text textWidget(Color textColor) =>
Text('I am a Text widget', style: TextStyle(color: textColor));