Skip to content
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

🐛 Not a Bug Report: There are two different Account classes #93

Closed
2 tasks done
vrescobar opened this issue Sep 19, 2022 · 7 comments
Closed
2 tasks done

🐛 Not a Bug Report: There are two different Account classes #93

vrescobar opened this issue Sep 19, 2022 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@vrescobar
Copy link

👟 Reproduction steps

There are two accounts: models.Account and appwrite.Account

👍 Expected behavior

While this is not an actual bug, it is annoying to say the least, and usually a bad practice. I would like to propose to refactor appwrite.Account (services/Account.dart) to AccountService and avoid name clash in the files that both definitions are needed.

👎 Actual Behavior

Unambiguous naming is hard, and I ended up with quite long refactoring due autoimports and large misunderstanding.

🎲 Appwrite version

Version 1.0.x

💻 Operating system

MacOS

🧱 Your Environment

Flutter

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@vrescobar vrescobar added the bug Something isn't working label Sep 19, 2022
@vrescobar
Copy link
Author

Perhaps it is between bug (usability) and enhancement.

@lohanidamodar
Copy link
Member

@vrescobar this is the downside of language that doesn't support namespace. We don't want to switch to AccountService for the sake of consistency across our SDKs and platforms. And we don't yet have a better solution than this where you can import import package:appwrite/models.dart as models to avoid name clash. Let us know if you have other better suggestions, which can help us be consistent and provide better usability as well.

@vrescobar
Copy link
Author

vrescobar commented Oct 11, 2022 via email

@biovolt
Copy link

biovolt commented Oct 11, 2022

or the sake of consistency across our SDKs and platform

I feel consistency must come second if it causes way worse side effects like code that does not compile and needs extra code in many places.
This causes way more other inconsistencies in the code.

@M123-dev
Copy link

M123-dev commented Jan 2, 2023

I totally agree with this, code generation and consistency is great, but this inconvenience is really not very pleasant

@jasimameen
Copy link

we can access the Service class by defining a custom Type for the Account.

// access Account using AccountService Type
typedef AccountService = Account

class Account extends Service {
// . . .
}

Using the above approach would solve this issue and also it won't affect existing written programs that use this class.

i want to contribute.

@stnguyen90
Copy link
Contributor

stnguyen90 commented Apr 18, 2023

The SDK now uses User instead of Account:

class User implements Model {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants