-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdart-snippets.code-snippets
120 lines (120 loc) · 3.76 KB
/
dart-snippets.code-snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
{
"Angular Component": {
"prefix": "ad-comp",
"description": "Angular Component",
"body": [
"@Component(",
"\tselector: '${1:component-selector}',",
"\ttemplateUrl: '${2:component_path}.html',",
"\tstyleUrls: ['${2:component_path}.css'],",
"\tdirectives: [coreDirectives],",
"\tproviders: [],",
")",
"class ${3:Name}Component {",
"}",
]
},
"Angular Directive": {
"prefix": "ad-directive",
"description": "Angular Directive",
"body": [
"@Directive(",
"\tselector: '${1:directiveSelector}',",
"\tproviders: [],",
")",
"class ${2:Name}Directive {",
"\tfinal Element element;",
"",
"\t${3:Name}Directive(this.element);",
"}",
]
},
"Angular Pipe": {
"prefix": "ad-pipe",
"description": "Angular pipe",
"body": [
"@Pipe('${1:pipeSelector}')",
"class ${2:Name}Pipe implements PipeTransform {",
"\ttransform(dynamic value) {",
"\t\t$0",
"\t}",
"}"
]
},
"Angular Component OnPush": {
"prefix": "ad-comp-push",
"description": "Angular Component using OnPush change detection",
"body": [
"@Component(",
"\tselector: '${1:component-selector}',",
"\ttemplateUrl: '${2:component_path}.html',",
"\tstyleUrls: ['${2:component_path}.css'],",
"\tdirectives: [coreDirectives],",
"\tproviders: [],",
"\tchangeDetection: ChangeDetectionStrategy.OnPush,",
")",
"class ${3:Name}Component {",
"\tfinal ChangeDetectorRef changeDetection;",
"",
"\t${3:Name}Component(this.changeDetection);",
"}",
]
},
"Angular Route Component": {
"prefix": "ad-comp-route",
"description": "Angular Route Component",
"body": [
"@Component(",
"\tselector: '${1:component-selector}',",
"\ttemplateUrl: '${2:component_path}.html',",
"\tstyleUrls: ['${2:component_path}.css'],",
"\tdirectives: [coreDirectives],",
"\tproviders: [],",
")",
"class ${3:Name}Component implements OnActivate, OnDeactivate {",
"",
"\t@override",
"\tvoid onActivate(RouterState previous, RouterState current) {",
"\t\t$0",
"\t}",
"",
"\t@override",
"\tvoid onDeactivate(RouterState current, RouterState next) {",
"\t}",
"",
"}",
]
},
"Angular Route Definition": {
"prefix": "ad-route",
"description": "Angular Route Definition",
"body": [
"final ${1:Name}Route = RouteDefinition(",
"\troutePath: ${2:RoutePath},",
"\tcomponent: ${3:ComponentFactory},",
");",
]
},
"Angular Route Definition Lazy": {
"prefix": "ad-route-lazy",
"description": "Angular Route Definition Lazy",
"body": [
"final ${1:Name}Route = RouteDefinition.defer(",
"\troutePath: ${2:RoutePath},",
"\tloader: () async {",
"\t\tawait ${3:deferredLibrary}.loadLibrary();",
"\t\treturn ${3:deferredLibrary}.${4:ComponentFactory};",
"\t},",
");",
]
},
"TrackBy Function": {
"prefix": "ad-trackby",
"description": "TrackBy Function",
"body": [
"${1:trackBy}(int index, item) {",
"\t$0",
"}"
]
}
}