-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use enum for EventType or assert them inside methods #40
Comments
I think enum fits well in this case. Only thing is that we should name values without underscores to comply with Dart style guide, e.g. Note that it would be a breaking change so would have to be released as We can approach this in two steps:
abstract class EventType {
static const String childAdded = 'child_added';
// ... etc
} Would be nice to update examples and dartdocs to refer to these constants so that it's easier to discover. All of this is non-breaking and we can release it in
How does this sound? |
naming: if we are not using the firebase string name I understand the possible breaking changes, so the two steps are pretty good ideas. |
Here is portion of official Dart style guide re: naming constants and enum values:
I'd prefer to stick to the style guide as it makes this Dart code consistent with most of the Dart code available on Pub and the Dart SDK itself. |
Oh, I see. I was searching for 'constant' and 'enum' but didn't catch it somehow. My bad. |
FYI: I added |
Since we are using Dart, could we use enum instead of raw String? It's less error-prone, help avoiding typo
it would be something like this
Or at least we could assert if eventType is valid inside the methods
The text was updated successfully, but these errors were encountered: