Skip to content

Column and Row should be using Iterable<Widget> instead of List<Widget> #170247

@Mikkelet

Description

@Mikkelet

Steps to reproduce

The current implementation of Column and Row (and really every widget that requires a list of widgets) requires that the children-parameter is a type of List. However, List is not an abstraction and is acutally mutable, which can cause issues if the user decides to add or remove items from the list without calling setState. This requirement also causes inconvenient behaviour when mapping a list of objects to widget, where it's suddenly required to call toList().

Expected results

Column(
      children: messages.map((message) => ChatBubble(chatMessage: message)),
    );

Actual results

Column(
      children: messages.map((message) => ChatBubble(chatMessage: message)).toList(),
    );

Code sample

Code sample
Column(
      children: messages.map((message) => ChatBubble(chatMessage: message)).toList(),
    );

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Flutter Doctor output

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: invalidIssue is closed as not valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions