-
Notifications
You must be signed in to change notification settings - Fork 248
Conversation
@@ -33,7 +33,7 @@ class DateFilter { | |||
'shortTime': 'h:mm a', | |||
}; | |||
|
|||
Map<num, NumberFormat> nfs = new Map<num, NumberFormat>(); | |||
Map<num, DateFormat> dfs = new Map<num, DateFormat>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Note: I like to write this as var dfs = <num, DateFormat>{};
to avoid having to change on both side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I've done so.
not NumberFormat but DateFormat
👍 |
I am assuming that no test was broken by this change. In which case this indicates that test(s) were missing :). Consider adding test(s). |
Since this file is being reviewed, note that the
Give that this is a filter class (hence its main service is offered via the I would suggestion the following declaration
but I know that @vicb will object to the type annotations :) ... preferring
Until I have finished preparing my blog post to explain why type annotations are useful when they contain generics, I can live with (2) :). |
@@ -33,7 +33,7 @@ class DateFilter { | |||
'shortTime': 'h:mm a', | |||
}; | |||
|
|||
Map<num, NumberFormat> nfs = new Map<num, NumberFormat>(); | |||
var dfs = <String, DateFormat>{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the purpose of dfs
. It is empty and never assigned to. Given that this is an @NgFilter
class it will only be instantiated by the dependency injector and access to this instance will be limited to use via an AngularDart pipe. Hence, clients will not have access to dfs
.
If I were to guess a use for dfs
it would be as a cache. In which case it should be populated with values just before line 61 after a value is obtained for df
; i.e.,
dfs[format] = df;
In this case dfs
should be made private: _dfs
.
set cache
and @chalin I think I got what you mean for non- |
Great, thanks. |
One more thing. In this article by Gilad Bracha, Emulating Functions in Dart, Gilad suggests that "As a matter of good style, have the class implement the |
Done. Thanks! |
Sorry, @vicb was correct about one thing. The style guide recommends "DO annotate with Object instead of dynamic to indicate any object is accepted". Please change the |
I actually was referring to the lines above that
|
@vicb caught one more thing: the return type of call should be |
done. |
not NumberFormat but DateFormat