Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore non-story functions inside stories files #65

Open
fertrig opened this issue Dec 22, 2022 · 0 comments
Open

Ignore non-story functions inside stories files #65

fertrig opened this issue Dec 22, 2022 · 0 comments
Labels
good first issue Good for newcomers preview Related to the Monarch Preview Window or monarch package

Comments

@fertrig
Copy link
Collaborator

fertrig commented Dec 22, 2022

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));
@fertrig fertrig added the preview Related to the Monarch Preview Window or monarch package label Dec 22, 2022
@fertrig fertrig changed the title Improve messaging for non-story functions inside stories files Ignore non-story functions inside stories files Dec 22, 2022
@fertrig fertrig added the good first issue Good for newcomers label Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers preview Related to the Monarch Preview Window or monarch package
Projects
None yet
Development

No branches or pull requests

1 participant