@@ -93,8 +93,8 @@ class NgPluralizeDirective {
93
93
final Scope scope;
94
94
final Interpolate interpolate;
95
95
int offset;
96
- var discreteRules = < String , String > {};
97
- var categoryRules = < Symbol , String > {};
96
+ final discreteRules = < String , String > {};
97
+ final categoryRules = < Symbol , String > {};
98
98
99
99
static final RegExp IS_WHEN = new RegExp (r'^when-(minus-)?.' );
100
100
static const Map <String , Symbol > SYMBOLS = const {
@@ -108,32 +108,34 @@ class NgPluralizeDirective {
108
108
109
109
NgPluralizeDirective (this .scope, this .element, this .interpolate,
110
110
NodeAttrs attributes) {
111
- var whens = attributes['when' ] == null
111
+ final whens = attributes['when' ] == null
112
112
? < String , String > {}
113
113
: scope.eval (attributes['when' ]);
114
114
offset = attributes['offset' ] == null ? 0 : int .parse (attributes['offset' ]);
115
115
116
116
element.attributes.keys.where ((k) => IS_WHEN .hasMatch (k)).forEach ((k) {
117
- var ruleName = k.replaceFirst ('when-' , '' ).replaceFirst ('minus-' , '-' );
117
+ var ruleName = k
118
+ .replace (new RegExp ('^when-' ), '' )
119
+ .replace (new RegExp ('^minus-' ), '-' );
118
120
whens[ruleName] = element.attributes[k];
119
121
});
120
122
121
123
if (whens['other' ] == null ) {
122
124
throw "ngPluralize error! The 'other' plural category must always be "
123
- "specified" ;
125
+ "specified" ;
124
126
}
125
127
126
128
whens.forEach ((k, v) {
127
129
Symbol symbol = SYMBOLS [k];
128
130
if (symbol != null ) {
129
- this . categoryRules[symbol] = v;
131
+ categoryRules[symbol] = v;
130
132
} else {
131
- this . discreteRules[k] = v;
133
+ discreteRules[k] = v;
132
134
}
133
135
});
134
136
}
135
137
136
- set count (value) {
138
+ void set count (value) {
137
139
if (value is ! num ) {
138
140
try {
139
141
value = int .parse (value);
0 commit comments