VsCode Snippets

Here is a summary of the available VsCode snippets.

Prefix
Description

ptm

Creates a filled-in modddel part statement

mclass

Creates a Modddel class

munion

Creates a Modddel union

munioncase

Adds a Case-Modddel for a Modddel union

failure

Creates a Failure class

failurecase

Adds a Failure union-case

{
    "Part 'Modddel' statement": {
        "prefix": "ptm",
        "body": [
            "part '${TM_FILENAME_BASE}.modddel.dart';"
        ],
        "description": "Creates a filled-in modddel part statement"
    },
    "Modddel Class": {
        "prefix": "mclass",
        "body": [
            "class ${1} extends ${2|SingleValueObject,MultiValueObject,SimpleEntity,ListEntity,SetEntity,MappedValuesEntity,MappedKeysEntity,KtListEntity,KtSetEntity,KtMappedValuesEntity,KtMappedKeysEntity,IListEntity,ISetEntity,IMappedValuesEntity,IMappedKeysEntity,MapEntity,KtMapEntity,IMapEntity|}<Invalid${1}, Valid${1}>",
            "    with _$${1} {",
            "  ${1}._();",
            "",
            "  factory ${1}(${3}) {",
            "    return _$${1}._create(${4});",
            "  }${0}",
            "",
            "}"
        ],
        "description": "Creates a Modddel class"
    },
    "Modddel Union": {
        "prefix": "munion",
        "body": [
            "class ${1} extends ${2|SingleValueObject,MultiValueObject,SimpleEntity,ListEntity,SetEntity,MappedValuesEntity,MappedKeysEntity,KtListEntity,KtSetEntity,KtMappedValuesEntity,KtMappedKeysEntity,IListEntity,ISetEntity,IMappedValuesEntity,IMappedKeysEntity,MapEntity,KtMapEntity,IMapEntity|}<Invalid${1}, Valid${1}>",
            "    with _$${1} {",
            "  ${1}._();",
            "",
            "  factory ${1}.${3}(${4}) {",
            "    return _$${1}._create${3/(^.)/${1:/upcase}/}(${5});",
            "  }${0}",
            "",
            "}"
        ],
        "description": "Creates a Modddel union"
    },
    "Case-Modddel": {
        "prefix": "munioncase",
        "body": [
            "factory ${1}.${2}(${3}) {",
            "  return _$${1}._create${2/(^.)/${1:/upcase}/}(${4});",
            "}${0}"
        ],
        "description": "Adds a Case-Modddel for a Modddel union"
    },
    "Failure": {
        "prefix": "failure",
        "body": [
            "@freezed",
            "class ${1}Failure extends ${2|ValueFailure,EntityFailure|} with _$${1}Failure {",
            "  const factory ${1}Failure.${3}(${4}) = _${3/(^.)/${1:/upcase}/};${0}",
            "}"
        ],
        "description": "Creates a Failure class"
    },
    "Failure Union Case": {
        "prefix": "failurecase",
        "body": [
            "const factory ${1}Failure.${2}(${3}) = _${2/(^.)/${1:/upcase}/};${0}"
        ],
        "description": "Adds a Failure union-case"
    }
}

Last updated