frf
is used to create the file header of the dart file contains freezed modelfrfjson
is used afterfrf
as file header when json is usedfrd
is used to create a freezed model class (name is aligned to file name by default)frjson
is used to createfromJson
constructor, which mark the model to be json serializablefre
is used to create an enumeration classfref
is used to create parameter-less case in enumeration classfrefd
is used to create parametered case in enumeration class
Last active
November 16, 2022 00:50
-
-
Save timnew/f16cfbe2888d546291919d34b5248d70 to your computer and use it in GitHub Desktop.
VSCode Code Snippet for Freezed and Dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"frf": { | |
"prefix": "frf", | |
"body": [ | |
"import 'package:freezed_annotation/freezed_annotation.dart';", | |
"", | |
"part '$TM_FILENAME_BASE.freezed.dart';", | |
"" | |
], | |
"description": "Frezed - file" | |
}, | |
"frfjson": { | |
"prefix": "frfjson", | |
"body": ["part '$TM_FILENAME_BASE.g.dart';", ""], | |
"description": "Frezed - file json" | |
}, | |
"frd": { | |
"prefix": "frd", | |
"body": [ | |
"@freezed", | |
"class ${1:${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}} with _$$1 {", | |
" const factory $1({$2}) = _$1;", | |
"}", | |
"" | |
], | |
"description": "Freezed - Class" | |
}, | |
"frjson": { | |
"prefix": "frjson", | |
"body": [ | |
"factory ${1:${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}}.fromJson(Map<String, dynamic> json) => _$$1FromJson(json);", | |
"" | |
], | |
"description": "Freezed - Json Constructor" | |
}, | |
"fre": { | |
"prefix": "fre", | |
"body": [ | |
"@freezed", | |
"class ${1:${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}} with _$$1 {", | |
" const $1._();", | |
"", | |
" const factory ${1:${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}}.$2() = ${4:${2/(.*)/${1:/pascalcase}/}}$5;", | |
"", | |
"$6", | |
"}" | |
], | |
"description": "Freezed - Enum Type delcaration" | |
}, | |
"fref": { | |
"prefix": "fref", | |
"body": [ | |
"const factory ${1:${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}}.$2() = ${4:${2/(.*)/${1:/pascalcase}/}}$5;", | |
"", | |
"$6" | |
], | |
"description": "Freezed - Enum Type constructor" | |
}, | |
"frefd": { | |
"prefix": "frefd", | |
"body": [ | |
"const factory ${1:${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}}.$2(${3:{}}) = ${4:${2/(.*)/${1:/pascalcase}/}}$5;", | |
"", | |
"$6" | |
], | |
"description": "Freezed - Enum Type constructor with data" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment