List Generator

List Generator

A quick way for creating lists of dummy items

Demo fo the stlsnamed snippet

This will generate a list with [0,1,2]

final list = List<int>.generate(
  3,
  (int index) => index,
);

Also a snippet fo' VSCode:

Copy and paste it into your where ever you have your snippets

"list generator": {
  "prefix": [
    "listgen"
  ],
  "body": [
    "final ${1:list} = List<${2:int}>.generate(",
    "  ${3:3},",
    "  (int index) => ${4:index},",
    ");",
    ""
  ],
  "description": "Creates list with a generator for items"
},