hukusuke1007 / flamingo

[Flutter Library] Flamingo is a firebase firestore model framework library. 🐤
https://pub.dev/packages/flamingo
MIT License
118 stars 20 forks source link

How can I set collection name for model #35

Closed vladaman closed 3 years ago

vladaman commented 3 years ago

We'd like to customize the collection name which model class uses. For example we use file name user_model.dart with UserModel class inside. We'd like the collection to be named users.

It would be handy to specify collection name using class annotation.

vladaman commented 3 years ago

So far I have found this solution to our requirement:

class UserModel extends Document<UserModel> {
  @override
  String get collectionPath => "users";
}
hukusuke1007 commented 3 years ago

@vladaman Can be set model name.

class UserModel extends Document<UserModel> {
  @override
  String get modelName => 'users';
}