Comments (5)
Here is portion of official Dart style guide re: naming constants and enum values:
https://www.dartlang.org/guides/language/effective-dart/style#prefer-using-lowercamelcase-for-constant-names :
In new code, use
lowerCamelCase
for constant variables, including 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.
from firebase-admin-interop.
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. EventType.childAdded
.
Note that it would be a breaking change so would have to be released as 2.0.0
which for such a small change might be hard to justify major version bump.
We can approach this in two steps:
- Add assertions as per your second suggestions, this would be non breaking. We can also add an abstract class with constants so that users are not forced to hard code strings. E.g.:
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 1.x.x
.
- When we gather enough breaking changes or there is upstream (JS SDK) change that requires us to bump major version to
2.0.0
we can replace the abstract class with an enum and update all method signatures accordingly.
How does this sound?
from firebase-admin-interop.
naming: if we are not using the firebase string name child_added
, I suggest considering uppercase low dash (ie. CHILD_ADDED
). Maybe it's just a personal preference, though it's also used for firebase.database.ServerValues.TIMESTAMP
.
I understand the possible breaking changes, so the two steps are pretty good ideas.
from firebase-admin-interop.
Oh, I see. I was searching for 'constant' and 'enum' but didn't catch it somehow. My bad.
from firebase-admin-interop.
FYI: I added EventType
with constants as per discussion and released together with your change of the on
method as 1.2.0
.
from firebase-admin-interop.
Related Issues (20)
- In queries, 'where' values are not converted to native type HOT 5
- Error: not supported HOT 1
- not to use new keyword anymore, and clean them out for next release? HOT 1
- Add support for new CollectionGroup Query
- firestore DocumentReference.update does not support Preconditions HOT 1
- [Feature request] please add support for admin.messaging HOT 20
- Update README with some basic run / deploy commands HOT 1
- Running Tests fail
- Firestore not working HOT 1
- Custom Claims restricts values to Strings HOT 3
- Cannot use UserRecord.customClaims HOT 1
- Add function to export Firestore documents to Storage. HOT 3
- [Feature Request] Please add support for admin.storage
- firebase_admin_interop builds are failing HOT 1
- Error: Module name "firebase-admin" has not been loaded yet for context: _. Use require([]) http://requirejs.org/docs/errors.html#notloaded error when trying to use firebase-admin-interop
- Where are put the serviceaccount json file in folder. HOT 1
- [Feature Request] Make more settings available to Firestore
- NNBD and Code Cleanup
- What happened did you guys deprecated the package?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebase-admin-interop.