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

[bug] SeparatedColumn throws error #3

Open
mzdm opened this issue Oct 16, 2022 · 0 comments · May be fixed by #4
Open

[bug] SeparatedColumn throws error #3

mzdm opened this issue Oct 16, 2022 · 0 comments · May be fixed by #4

Comments

@mzdm
Copy link

mzdm commented Oct 16, 2022

Let's say you have list:

  final myList = <String>['hello', 'dog', 'launch'];

and you pass it to SeparatedColumn / SeparatedRow, it throws error:

SeparatedColumn(
    separatorBuilder: () => SizedBox(height: 12),
    children: myList.map((e) => Text('$e\n')).toList(), // Throws error SeparatedColumn: type 'SizedBox' is not a subtype of type 'Text' of 'element'.
  )

This, however builds fine:

SeparatedColumn(
    separatorBuilder: () => SizedBox(height: 12),
    children: [
      ...myList.map((e) => Text('$e\n')),
    ],
  )

Not sure the building process in the Flutter framework but I've the fix. My guess it was modifying the original list which was used somewhere while building so I'm copying it. I've added a test for it.

mzdm added a commit to mzdm/flutter-flextras that referenced this issue Oct 16, 2022
@mzdm mzdm linked a pull request Oct 16, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant