Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions snippets/dart-mode/aclass
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: aclass
# key: acls
# --
abstract class ${1:Name} {
$0
}
7 changes: 7 additions & 0 deletions snippets/dart-mode/class
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: class
# key: cls
# --
class ${1:Name} {
$0
}
5 changes: 5 additions & 0 deletions snippets/dart-mode/ext
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: ext
# key: ext
# --
extends ${1:Name}$0
8 changes: 8 additions & 0 deletions snippets/dart-mode/for
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: for
# key: for
# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region nil))
# --
for(var i = ${1:0}; i ${2:< 10}; i${3:++}) {
$0
}
8 changes: 8 additions & 0 deletions snippets/dart-mode/fori
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: fori
# key: fori
# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region nil))
# --
for(var ${1:obj} in ${2:collection}) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here

$0
}
7 changes: 7 additions & 0 deletions snippets/dart-mode/func
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: fun
# key: fun
# --
${1:Type} ${2:Name}($3) {
$0
}
7 changes: 7 additions & 0 deletions snippets/dart-mode/funca
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: funca
# key: afun
# --
${1:Type} ${2:Name}($3) async {
$0
}
7 changes: 7 additions & 0 deletions snippets/dart-mode/getset
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: getset
# key: getset
# --
${1:Type} _${2:Name};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that such a common pattern to have it this way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, getters are commonly used. This is generic pattern but it applies pretty well in this case.

Copy link
Contributor Author

@l7ssha l7ssha Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if you mean '_Name' notation - '_' in Dart means 'private' in C like programming languages, so it has to be like that.

$1 get $2 => _$2;
set $2($1 $2) => _$2 = $2;$0
6 changes: 6 additions & 0 deletions snippets/dart-mode/getter
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: getter
# key: get
# --
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

${1:Type} _${2:Name};
$1 get $2 => _$2;$0
5 changes: 5 additions & 0 deletions snippets/dart-mode/impl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: impl
# key: impl
# --
implements ${1:Name}$0
5 changes: 5 additions & 0 deletions snippets/dart-mode/import
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: import
# key: imp
# --
import '${1:Library}';$0
7 changes: 7 additions & 0 deletions snippets/dart-mode/main
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: main
# key: main
# --
main(List<String> args) {
$0
}
5 changes: 5 additions & 0 deletions snippets/dart-mode/part
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: part
# key: part
# --
part of ${1:Part}$0
6 changes: 6 additions & 0 deletions snippets/dart-mode/setter
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: setter
# key: set
# --
${1:Type} _${2:Name};
set $2($1 $2) => _$2 = $2;