Skip to content

Instantly share code, notes, and snippets.

@AlexMeuer
Last active September 29, 2023 07:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexMeuer/3a248636e58032f86e23d2e10ed81e8b to your computer and use it in GitHub Desktop.
Save AlexMeuer/3a248636e58032f86e23d2e10ed81e8b to your computer and use it in GitHub Desktop.
VSCode User Snippets and Settings
{
"Part statement": {
"prefix": "pts",
"body": [
"part '${TM_FILENAME_BASE}.g.dart';",
],
"description": "Creates a filled-in part statement"
},
"Part 'Freezed' statement": {
"prefix": "ptf",
"body": [
"part '${TM_FILENAME_BASE}.freezed.dart';",
],
"description": "Creates a filled-in freezed part statement"
},
"Freezed Data Class": {
"prefix": "fdataclass",
"body": [
"@freezed",
"@immutable",
"class ${1:DataClass} with _$${1:DataClass}{",
" const factory ${1:DataClass}(${2}) = _${1:DataClass};",
"}"
],
"description": "Freezed Data Class"
},
"Freezed Union": {
"prefix": "funion",
"body": [
"@freezed",
"@immutable",
"class ${1:Union} with _$${1:Union}{",
" const factory ${1:Union}.${2}(${4}) = _${2/(\\w)(.*)/${1:/upcase}$2/};",
" $0",
"}"
],
"description": "Freezed Union"
},
"Freezed Union Case": {
"prefix": "funioncase",
"body": [
"const factory ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}.${1}(${2}) = _${1/(\\w)(.*)/${1:/upcase}$2/};",
"$0"
],
"description": "Freezed Union Case"
},
"Value Object": {
"prefix": "vobj",
"body": [
"class ${1:ClassName} extends ValueObject<${2}>{",
" @override",
" final Either<ValueFailure<${2}>, ${2}> value;",
"",
" factory ${1:ClassName}(${2} input) {",
" return ${1:ClassName}._(",
" ${4:// * TODO: insert validation}",
" );",
" }",
"",
" const ${1:ClassName}._(this.value);",
"}"
]
},
"Value Failure": {
"prefix": "vfail",
"body": [
"const factory ValueFailure.${1}({@required T failedValue}) = ${1/(\\w)(.*)/${1:/upcase}$2/}<T>;",
"$0"
]
},
"Freezed Import": {
"prefix": "fimp",
"body": [
"import 'package:freezed_annotation/freezed_annotation.dart';",
"$0"
]
},
"Assert Not Null": {
"prefix": "ann",
"body": [
"assert(${1} != null)$0"
]
},
"IRepository": {
"prefix": "irepo",
"body": [
"import 'package:built_collection/built_collection.dart';",
"import 'package:dartz/dartz.dart';",
"",
"abstract class I${1:Model}Repository {",
" Stream<Either<${1}Failure, BuiltList<${1}>>> watchAll();",
" Future<Either<${1}Failure, Unit>> create(${1} ${1/(\\w)(.*)/${1:/downcase}$2/});",
" Future<Either<${1}Failure, Unit>> update(${1} ${1/(\\w)(.*)/${1:/downcase}$2/});",
" Future<Either<${1}Failure, Unit>> delete(${1} ${1/(\\w)(.*)/${1:/downcase}$2/});",
"}"
]
},
"Bloc Event Handler": {
"prefix": "evha",
"body": "(e) async* {$0}"
},
"FromJson Factory Ctor": {
"prefix": "fromjson",
"body": "factory ${1:Type}.fromJson(Map<String, dynamic> json) => _$${1}FromJson(json);"
},
"JsonKey Annotation": {
"prefix": "jkey",
"body": "@JsonKey(name: '$1')$0"
},
"Injectable Module": {
"prefix": "dimod",
"body": [
"import 'package:injectable/injectable.dart';",
"",
" $0",
"",
"}",
]
}
}
{
"workbench.iconTheme": "material-icon-theme",
"editor.fontLigatures": true,
"editor.fontFamily": "Fira Code, Fantasque Sans Mono, Mononoki , Menlo, Monaco, 'Courier New', monospace",
"flutterStylizer.memberOrdering": [
"public-static-variables",
"private-static-variables",
"public-constructor",
"named-constructors",
"public-instance-variables",
"private-instance-variables",
"public-override-methods",
"public-other-methods",
"build-method"
],
"dart.previewFlutterUiGuides": true,
"window.titleBarStyle": "custom",
"workbench.colorCustomizations": {
"window.activeBorder": "#e3b878",
"window.inactiveBorder": "#82745c",
"menubar.selectionBackground": "#373737",
"statusBar.debuggingForeground": "#9df397",
"statusBar.debuggingBorder": "#289a83",
"statusBar.debuggingBackground": "#183548"
},
"material-icon-theme.folders.associations": {
"global_state": "global",
"ui": "layout",
"bloc": "controller",
"blocs": "controller",
"application": "app",
"domain": "content",
"presentation": "environment",
"exceptions": "error",
"repositories": "pipe",
"data_sources": "database",
"ioc": "generator",
".dart_tool": "delta",
"infrastructure": "pipe",
"pkg": "packages",
"cmd": "command",
"internal": "src",
"deployments": "upload"
},
"editor.fontSize": 16,
"editor.formatOnSave": true,
"materialTheme.accent": "Acid Lime",
"editor.acceptSuggestionOnEnter": "smart",
"editor.minimap.enabled": false,
"dart.debugExternalLibraries": false,
"dart.debugSdkLibraries": false,
"[dart]": {
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.rulers": [
80
],
"editor.selectionHighlight": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.suggestSelection": "first",
"editor.tabCompletion": "onlySnippets",
"editor.wordBasedSuggestions": false
},
"terminal.integrated.fontFamily": "Mononoki",
"terminal.integrated.fontSize": 16,
"workbench.colorTheme": "Gruvbox Material Dark"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment