Completions for a list of widgets should not be parameterized

@johnpryan commented on Mar 31, 2020, 4:01 PM UTC:

Use case

The reccomended completion for widgets with a children parameter is list literal with a parameterized type (<Widget>[]).

This isn’t necessary because the generic type for the list can be inferred.

Example

Getting a completion for children in this snippet recommends <Widget>[]:

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column();
  }
}

Screen Shot 2020-03-31 at 8 49 17 AM

The most common way to write this is:

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Text("foo"),
        Text("baz"),
      ],
    );
  }
}

Proposal

Omit the generic type parameter, so the completion becomes [].

This issue was moved by devoncarew from flutter/flutter#53664.

Author: Fantashit

1 thought on “Completions for a list of widgets should not be parameterized

Comments are closed.